https://gohugo.io/templates/pagination/#list-paginator-pages
For a given Page, it’s one of the options above. The
.Paginator
is static and cannot change once created.If you call
.Paginator
or.Paginate
multiple times on the same page, you should ensure all the calls are identical. Once either.Paginator
or.Paginate
is called while generating a page, its result is cached, and any subsequent similar call will reuse the cached result. This means that any such calls which do not match the first one will not behave as written.
This describes the problem in a little more detail:
https://discourse.gohugo.io/t/determine-if-current-page-is-result-of-pagination/37494/4
This describes a strategy (with example) for doing what you want to do:
https://discourse.gohugo.io/t/control-pagination-and-page-collections-from-baseof-html/37643/8