Chaging Pagination (or other site params) per section

Is it possible to have different values for “paginate” for each section? Right now paginate is a “.site” parameter. Is it possible to do this without hacking the pagination template?

Longer version:
I would like each section of my site to have different values of the parameters typically associated with the site’s global config. Ideally, I would like to be able to set “site” parameters in the frontmatter of my “” files. I would prefer not to have to make custom templates for pagination.


So, you cannot set “paginate” per section, but you can do something ala:

{{ $ignore := .Paginator 1234 }}
{{ template "_internal/pagination.html" . }}

And read the value of 1234 from … somewhere.

Thank you. This will solve the immediate problem!

But, can you help me understand why?

Why does setting a dummy variable change the behavior of the paginator?

I’d like to understand why this works, so I can do so similar things later.

(I did confirm that it does work - but it seems like voodoo. I am not sure why setting an unused variable has this effect. And it works even though the theme I am using defines its own “pagination.html” that is called via partial, not template)

Thanks for the help!


The paginated result is static, that is: There is at most one per page. And it’s created on demand, so if you do:

{{ $ignore := .Paginator 1234 }}
{{ $paginate := .Paginator }}

Both $ignore and $paginate will contain exactly the same.

If you look at the built-in pagination template you will see that it just simply invokces .Paginate – and if you had not invoked it first with a different page size (1234), it would have created one with the configured value for paginate.

1 Like

Great Explanation! That helps explain a lot of things and gives me ideas on how to address other issues.

A very newbie question: do I need to get the source release in order to see the “built in” templates like
“_internal/pagination.html” or is there another way?

Again, thank you very much!

No. See


Thank you!

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