By default there are as many as 9 buttons (first, prev, slots 1-5, next, last) in Hugo’s internal pagination template. But there’s an alternate ‘terse’ format that reduces that to a maximum of 7 buttons (first, prev, slots 1-3, next, last). To use the alternate format–
- Add the code below to your templates if you’re using the internal pagination.
{{ template "_internal/pagination.html" (dict "page" . "format" "terse") }}
- Otherwise, Create a custom pagination file in
./layouts/partials
folder, let’s call itpagination.html
.- Open Hugo’s internal pagination template.
- Copy the code before/above
{{/* Format: default
and the code from{{/* Format: terse
to thepagination.html
file. - Use the file in your templates as follows:
{{ partial "pagination.html" (dict "page" . "format" "terse") }}
.