Hugo

Pagination by a tag

How can I paginate posts by a taxonomy tag?

It seems like updating setting $paginator has no effect. No matter what I set it, to the same list is displayed. If I update the range directly it loads the right posts but then the pagination links are not reflecting the new list of posts.

{{ $paginator := .Paginate .Site.Taxonomies.tags.blog }}
{{ range $paginator.Pages }}...{{ end }}
{{ template "_internal/pagination.html" . }}

Hi there,

I’m not sure I understand what you are trying to do. Do you mean you want a paginated list of tags from inside a post?

Where are you putting this code, and what output do you expect it to produce?

Do you have your code somewhere we can have a look at?

I am trying to paginate a site taxonomy on a page. I have a code example in the original post. I expect it to show and paginate only post in the taxonomy tagged blog.

This should work, but Pagination is only available on list templates (index.html, section.html, list.html etc…) so first thing to check is you’re not working on a single.html or a custom template assigned to a single page.

I am trying to do it on a single page. Is there anyway to do it on single pages?

No:

Hugo supports pagination for your homepage, section pages, and taxonomies.

1 Like