Following the tutorial Pagination | Hugo, and using their suggested method for overriding global page size doesn’t seem to work, this is my template code:
{{ $paginator := (.Paginator 5) }}
{{ range $paginator.Pages }}
...
{{ end }}
Even though I’m passing a 5 it continues to return 10 items per page, which is the global setting.
We generate these paginated pages on demand on first invocation for a page
So, if you say
{{ $paginator := (.Paginator 10) }}
{{ $paginator := (.Paginator 5) }}
The last invocation will return 10 pages (which, I admit, can be a bit confusing – but it’s a static site generator, so we cannot return a different page set).