Problem with .Paginate


I have the following problem with .Paginate in a theme.

   <div class="col-sm-{{ if .Site.Params.showRightSidebar }}9{{ else }}12{{ end }}">
        {{ $paginator := .Paginate (where site.RegularPages "Type" "post") }}
        {{ printf "%s %s" $paginator (where site.RegularPages "Type" "post") }}
        {{/* range $paginator.Pages }}
          {{ .Render "summary" }}
        {{ end }}
        {{ partial "bloc/content/pagination.html" . */}}

The displayed result is:

<nil> Pages(2)

Why is the $paginator variable nil when 2 Pages seem to be available? This obviously breaks the loop that I have commented below. What am I doing wrong?

Strangely, the same partial on the index page is working.

This is with hugo v0.68.3/extended windows/amd64.

Thanks for your help.



The paginator is only available on list pages (home, sections, etc…). Is it possible you’re using your partial on a regular page?


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