HUGO

Paginate does not work on single page template but works on homepage template

I have the following directory structure :
content/

  • posts/
    • post-A/
      • index.md
    • post-B/
      • index.md

I am using the following paginator in my home page template index.html and it works.
{{ $paginator := .Paginate (where .Site.RegularPages "Section" "posts") 6 }}
(I have 9 sample posts on my localhost, so get 2 pages created for homepage)
However, the same paginator code on _default/single.html for a regular page results in nil. I also tried the site.RegularPages, .Pages, .Site.Pages but same result.

Why this behaviour on my single page? Can somebody plesae help. Am I hitting a bug? My hugo version is v0.74.3/extended darwin/amd64.

Paginator only works on the homepage and list pages: https://gohugo.io/templates/pagination/#list-paginator-pages

Oh. Thanks for the quick response.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.