Paginator in section template now working?

Does anyone know why paginator in section template is not working?
I have this directory structure

- content
    - articles content
- layouts
    - _default
        - section.html

In section.html, when I use {{ range .Pages }} its work fine with displaying all pages within that section. But when I change it to {{ range .Paginator.Pages }} returns empty.

And my paginator in taxonomy page list.html working fine. I wondering why my code doesn’t work :frowning:

Theme repository:


Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

1 Like

I have edited my post, this is my repository

hugo new site foo
cd foo
git init
git submodule add themes/hugoblog


baseURL = ""
languageCode = "en-us"
title = "My New Hugo Site"
theme = "hugoblog"

Then I generated 20 articles:

└── articles

Now build…



Start building sites … 
Total in 35 ms
Error: Error building site: failed to render pages: render of "home" failed: execute of template failed: template: index.html:23:31: executing "main" at <partial "card/card-horizontal-mini.html" .>: error calling partial: "/home/jmooring/temp/joe/themes/hugoblog/layouts/partials/card/card-horizontal-mini.html:25:29": execute of template failed: template: partials/card/card-horizontal-mini.html:25:29: executing "partials/card/card-horizontal-mini.html" at <first 1 .Params.categories>: error calling first: both limit and seq must be provided

Please fix the error, update your repo, then let me know.

layouts/_default/section.html is called when generating articles/index.html.

layouts/_default/section.html template does this:

{{ range .Paginator.Pages }}
  {{ partial "card/card-horizontal.html" . }}
{{ end }}

But, before it does that, it does this:

{{- partial "head.html" . -}}

layouts/partials/head.html does this:

{{ if eq .Section "articles" }} 
  <!-- Pagination meta tags for list pages only -->
  {{ $paginator := .Paginate (where .Pages "Section" "blog") }}
  {{ if $paginator }}
  {{end }}
{{ end }}

You can’t do that.


For a given Page, it’s one of the options above. The .Paginator is static and cannot change once created.

1 Like

Here’s a similar issue:

I just deleted my Paginator in head.html and it works fine! So the conclusion is I can’t use two paginator in one page.

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