'pager size' must be a positive integer

Hi, I got a strange error:

Start building sites … 
hugo v0.92.2-CDF6A0D6+extended linux/amd64 BuildDate=2022-02-11T14:17:39Z VendorInfo=gohugoio
Error: Error building site: failed to render pages: render of "section" failed: "/home/razonyang/Projects/razonyang/hugo-theme-bootstrap/layouts/_default/archive.html:46:18": execute of template failed: template: _default/archive.html:46:18: executing "title$htmltemplate_stateRCDATA_elementTitle" at <.Paginate>: error calling Paginate: 'pager size' must be a positive integer
Built in 1539 ms

Related layouts as follows(line 43-47):

{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
{{- $size := (int .Site.Params.archive.paginate) }}
{{- printf "size: [%d]" $size -}}
{{- $paginator := .Paginate $pages.ByDate.Reverse $size -}}
{{- partial "head/title" . -}}

And then I change {{- $paginator := .Paginate $pages.ByDate.Reverse $size -}} to {{- $paginator := .Paginate $pages.ByDate.Reverse 1 -}} for displaying the value of .Site.Params.archive.paginate:

size: [100]

I have no clue to figure it out. I’d appreciate some help.

I am unable to reproduce the problem. Please share your repository or a minimal example so that we can easily reproduce the problem.

1 Like

My repo(theme-config branch): GitHub - razonyang/hugo-theme-bootstrap at theme-config.

Commit: chore: create theme config · razonyang/hugo-theme-bootstrap@73e0403 · GitHub

I’m trying to define some theme’s parameters. I generated HTML files, and find out some pages don’t retrieve the parameter, the theme’s parameter wasn’t applied by zh-cn and zh-tw language:

I guess I found out the reason:

    dateFormat = "2006-01-02"
      dateFormat = "01-02"

zh-cn.params.archive replaces the theme’s params.archive instead of merging, so there is no params.archive.paginate parameter. I’m not sure if it’s a bug.

if you haven’t seen it.

I read this documentation, and make some changes, and it works now:

  1. Remove [zh-cn.params.archive] and [zh-tw.params.archive] sections from languages.toml.
  2. Add [archive] to params.toml:
  dateFormat = "01-02"

Hugo doesn’t seem to do deep merging the params from languages.toml.