allow customizing pagination by adding "paginate" in frontmatter

This commit is contained in:
Reorx 2022-04-14 15:06:17 +08:00
parent 45d3fa868e
commit d94f895296
1 changed files with 7 additions and 1 deletions

View File

@ -30,7 +30,13 @@
{{- $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
{{- end }}
{{- $paginator := .Paginate $pages }}
{{/* related issue: https://github.com/gohugoio/hugo/issues/9003 */}}
{{ $paginator := "" }}
{{ if (.Param "paginate") }}
{{- $paginator = .Paginate $pages (.Param "paginate") }}
{{ else }}
{{- $paginator = .Paginate $pages }}
{{ end }}
{{- if and .IsHome site.Params.homeInfoParams (eq $paginator.PageNumber 1) }}
{{- partial "home_info.html" . }}