Pagination not supported

I get the following error

ERROR render of “/Users/peter/5volts/v2/content/pages/downloads/rlv12emulator.md” failed: “/Users/peter/5volts/v2/themes/hugo-theme-hamburg/layouts/_default/single.html:1:3”: execute of template failed: template: _default/single.html:1:3: executing “_default/single.html” at <partial “header.html” .>: error calling partial: “/Users/peter/5volts/v2/themes/hugo-theme-hamburg/layouts/partials/header.html:84:24”: execute of template failed: template: partials/header.html:84:24: executing “partials/header.html” at <.Paginate>: error calling Paginate: pagination not supported for this page: kind: “page”, path: “/pages/downloads/rlv12emulator”, file: “/Users/peter/5volts/v2/content/pages/downloads/rlv12emulator.md”

After upgrading from 0.121.1 to 0.145 and switching from Intel to ARM (yes I did both at the same time) I get the above errors and I have no clue where to start to fix this issue. Any suggestions what went wrong and what where I should look first?

That template is invoking either the Paginate or Paginator method while rendering a single page. That’s not allowed.

1 Like

That’s what I thought as well. I will have another look into the documentation of the method perhaps I missed something. However, when I delete this file the error just moves to the previous file. The files have multiple pages and as I mentioned, I did not get these errors with previous versions of hugo.

Edit: I think I looked at the wrong place, the problem is not related to my content but to changes in the theme, found an older version of the theme and this renders perfectly. So I need to check which change causes this error.

With the current version of the theme, you need to:

mkdir -p layouts/partials
cp themes/hugo-theme-hamburg/layouts/partials/header.html layouts/partials

Then edit the file you just created. Change this:

{{ with $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
  {{ if $paginator.HasPrev }}
    <link rel="prev" href="{{ $paginator.Prev.URL | absURL }}" />
  {{ end }}
  {{ if $paginator.HasNext }}
    <link rel="next" href="{{ $paginator.Next.URL | absURL }}" />
  {{ end }}
{{ end }}

To this (wrap with “if”):

{{ if eq .Kind "home" }}
  {{ with $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
    {{ if $paginator.HasPrev }}
      <link rel="prev" href="{{ $paginator.Prev.URL | absURL }}" />
    {{ end }}
    {{ if $paginator.HasNext }}
      <link rel="next" href="{{ $paginator.Next.URL | absURL }}" />
    {{ end }}
  {{ end }}
{{ end }}

And please log an issue with the theme author:
https://github.com/hauke96/hugo-theme-hamburg/issues

It was never possible to paginate when the page kind was page, but we didn’t tell you there was a problem prior to v0.123.0.

First a big thanks, it would have taken weeks for me to find this. I let you know when I succeed and will contact the authormof the theme.

Edit: YES, no errors and my website compiles again

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.