I have an issue where custom paginated items do not go beyond the default one by Hugo (10). If I define, say first 5
, five items show up. But if I do first 15
, then the number is stuck at 10. I am not sure if it is due to my .Paginate
code which I have at the head and list pages as follows.
Summary
<!-- head.html -->
{{- $paginator := "" -}}
{{- if or (and (.IsSection) (eq .Params.sec "blog") ) -}} <!-- Params.sec "blog" here is a front matter variable added to the blog section's _index.md for default/translated pages -->
{{- $p := slice -}}
{{- range (where site.Pages "Type" "post").ByDate -}}
{{- if or
(and .IsPage (not (eq .Layout "multipage" )))
(and .IsSection (eq .Layout "multipage" ))
-}}
{{- $p = $p | append . -}}
{{- end }}
{{- end -}}
{{- $paginator = .Paginate ($p.ByDate.Reverse) -}}
{{- end -}}
{{- if or (.IsSection) ( and (.IsSection) (ne .Layout "multipage") ) -}}
{{- $page := .Pages -}}
{{- $paginator = .Paginate ($page.ByDate.Reverse) -}}
{{- end -}}
{{- if or (and (.IsSection) (eq .Params.sec "blog") ) ( and (.IsSection) (ne .Layout "multipage") ) -}}
{{- if (eq $paginator.PageNumber 1) -}}
<link rel="canonical" href="{{ .Permalink }}">
{{ else }}
<link rel="canonical" href="{{ .Permalink }}page/{{ $paginator.PageNumber }}/">
{{ end }}
{{- if $paginator.HasPrev -}}
<link rel="prev" href="{{ .Paginator.Prev.URL }}">
{{ end }}
{{- if $paginator.HasNext -}}
<link rel="next" href="{{ .Paginator.Next.URL }}">
{{ end }}
{{- end }}
Summary
<!-- list.html -->
{{- $page := slice -}}
{{- if eq .Params.sec "blog" -}}
{{- $p := slice -}}
{{- range (where site.Pages "Type" "post").ByDate -}}
{{- if or
(and .IsPage (not (eq .Layout "multipage" )))
(and .IsSection (eq .Layout "multipage" ))
-}}
{{- $page = $p | append . -}}
{{- end -}}
{{- end -}}
{{ else }}
{{- $page = .Pages }}
{{- end }}
{{- $paginator:= .Paginate ($page.ByDate.Reverse) -}}
I am wondering if there is a conflict between those two instances hence why the numbered items per page are not overriding the default. I am asking for help to diagnose this.