gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.78k stars 7.53k forks source link

Deprecate Page.IsNode #11574

Open jmooring opened 1 year ago

jmooring commented 1 year ago

Why?

onedrawingperday commented 1 year ago

Not in favour of this proposal as I am using it in my templating.

It is an older variable and there are still projects from 5 years ago that make use of it.

Please don’t make breaking changes because some things seem unclear.

bep commented 1 year ago

This needs to at least wait (and in any case, we can limit the change to the documentation to start with).

jmooring commented 12 months ago

Updated documentation.

github-actions[bot] commented 11 months ago

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.

jmooring commented 7 months ago

I'm reopening this because we recently introduced the concept of logical paths, and the easiest way to describe a logical path is the path between two nodes on a node tree, either relative to each other or absolute from the root of the tree.

In a data structure, the term "node" is never limited to a parent. https://en.wikipedia.org/wiki/Tree_(data_structure)

But our existing definition of node is limited to page kinds home, section, taxonomy, term, 404, and maybe some others, but the definition excludes page kind page.

I would like to deprecate .Page.IsNode recommending the use of not .IsPage instead. .IsPage returns false for page kinds home, section, taxonomy, term, 404, and maybe some others.

This is not a technical issue... .IsNode works fine. This is about the language of Hugo, the opportunity to clarify concepts in documentation, and to use terminology that is generally accepted.


Alternatively we could rename .Page.IsNode (and how we name it internally) to .Page.IsList per: https://github.com/gohugoio/hugo/blob/master/resources/page/page.go#L214

IsNode returns whether this is an item of one of the list types in Hugo,

jmooring commented 7 months ago

@bep Please comment when you have a moment. Thanks.