ve9u
1
Hi, I am new to Hugo. I would like know whether it is possible to extend the pagination URL with anchor tags or not.
It looks like the only way to get pagination outputs currently is:
- /{{PaginatePath}}/2/
- /{{PaginatePath}}/3/
However, I need something like
- /{{PaginatePath}}/2/#anchor
- /{{PaginatePath}}/3/#anchor
I assume that your list.html file(s) contain something like:
{{ range .Paginator.Pages }}
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
<p>{{ .Summary }}</p>
{{ end }}
Change this to:
{{ range .Paginator.Pages }}
<h2 id="{{ .Title | anchorize }}"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
<p>{{ .Summary }}</p>
{{ end }}
You can use the id
attribute of the h2
element as the anchor portion of your link, assuming that your titles are unique on any single pagination page.