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

.IsNode is true for 404.html #12162

Open
skrysmanski opened this issue Feb 26, 2024 · 2 comments
Open

.IsNode is true for 404.html #12162

skrysmanski opened this issue Feb 26, 2024 · 2 comments

Comments

@skrysmanski
Copy link

As discussed here, .IsNode should be false for the 404.html template.

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

$ hugo version
hugo v0.123.3-a75a659f6fc0cb3a52b2b2ba666a81f79a459376+extended linux/amd64 BuildDate=2024-02-23T17:09:20Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes

@skrysmanski
Copy link
Author

skrysmanski commented Mar 3, 2024

I think the primary question here is: What does .IsNode actually mean.

The documentation simply states:

Reports whether the given page is a node.

What exactly makes a page a node? (Or: What exactly is a node, semantically?) Is this documented somewhere?

My interpretation is that a "node page" is a collection of pages. But this would not apply to the 404, or would it?

@jmooring
Copy link
Member

jmooring commented Mar 3, 2024

{{ .Kind }}       --> 404 (correct)
{{ .Type }}       --> page (correct)

{{ .IsHome }}     --> false (correct)
{{ .IsSection }}  --> false (correct)

{{ .IsNode }}     --> true (??)
{{ .IsPage }}     --> false (??)

I learned yesterday that the 404 template receives a Pages collection in context (seems to be equivalent to Site.Pages), and you can paginate within this template. So in that sense it is a "node". Having said that, I don't know why it receives pages in context, and the ability to paginate within this template is new in v0.123.0 (which lead to #12192).

See also #11574.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants