I see .Site.Params and $.Site.Params in almost all examples but .Site.Params can break depending on what the dot is set to whereas site.Params (the global version) should work everywhere and is shortest. Are there any cases where the first two would make more sense before I do a hasty global search and replace in a project? Thanks!
There is no better or worse. It’s only a matter of preference.
site is a function that operates from the global context, so that the template context doesn’t matter.
site has been introduced I’ve never used
.Site anymore. With the first one you’ll never have to worry about the current context… so why bother
site function. It sounds great.
But I cannot find information about the use of this function in the Documentation.
I do not maintain the Hugo Docs.
Feel free to open an issue over here: Issues · gohugoio/hugoDocs · GitHub
Not sure why this was closed: Document existence of site global function · Issue #1119 · gohugoio/hugoDocs · GitHub
All the methods below, e.g.
.Site.RegularPagescan also be reached via the global
site.RegularPages, which can be handy in partials where the
Pageobject isn’t easily available.
Thank you so much @pointyfar
This topic was automatically closed after 22 hours. New replies are no longer allowed.