Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: error calling Paginator: pagination not supported for this page: kind: "page" #12080

Closed
skrysmanski opened this issue Feb 20, 2024 · 4 comments

Comments

@skrysmanski
Copy link

Up until Hugo 0.122, you could (in a partial) check if the current page is paginated like this:

{{- if .Page.Paginator -}}

Since Hugo 0.123 this is no longer possible. Instead you get this error:

error calling Paginator: pagination not supported for this page: kind: "page"

I reckon that this could be an intended change, although it's not listed in the list of breaking changes (#11455) and so I thought to better report it.

The change could be related to #11949 but I never experienced this bug (it simply worked for me).

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.123.0-3c8a4713908e48e6523f058ca126710397aa4ed5+extended windows/amd64 BuildDate=2024-02-19T16:32:38Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes

@bep
Copy link
Member

bep commented Feb 20, 2024

This was a bug fix.

You can do something ala:

{{- if and .Page.IsNode .Page.Paginator -}}

@jmooring
Copy link
Member

Be careful when using .IsNode as suggested above; it returns true in the 404 template. See #12162 and #12192.

@shinyzhu
Copy link

This is interesting. It's still there when I updated to 0.124.1.

Thanks for the .IsNode check. That works fine.

Be careful when using .IsNode as suggested above; it returns true in the 404 template. See #12162 and #12192.

So are there any other better solutions?

j-talas added a commit to j-talas/hugo-theme-diary that referenced this issue Mar 29, 2024
Hugo site build (using version 0.123.3) was failing below error message. This is due to a change in Hugo itself, see ref.
Backward compatibility confirmed using Hugo version 0.122.0
Forward compatibility confirmed using Hugo version 0.124.1 (latest as of now)

ERROR render of "page" failed: ".../themes/diary/layouts/_default/baseof.html:15:16": execute of template failed: template: _default/single.html:15:16: executing "_default/single.html" at <partial "extrabar.html" .>: error calling partial: ".../themes/diary/layouts/partials/extrabar.html:28:19": execute of template failed: template: partials/extrabar.html:28:19: executing "partials/extrabar.html" at <.Paginator>: error calling Paginator: pagination not supported for this page: kind: "page", path: "...", file: "..."

Ref: AmazingRise#177
Ref: gohugoio/hugo#12080
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants