We currently provide access to time.Now() by way of hugolib/Page.Now(). The current system time has no real relationship to a Page, so it seems odd making it available this way. Additionally, to access the current time in a template, you must have a Page in your context (there are partial template scenarios where the Page may not be in context).
Proposal: Add a now template function and deprecate .Page.Now in v0.19.
The referenced PR changed from timeNowUTC to timeNow (I think he realized he could do timeNow.UTC after submitting the PR). I’m proposing we simply call the func now.
@budparr Yes. {{ .Now.Format "2006" }} works perfectly. But .Now is on the “Page” object, not a template function.
@moorereason’s primary reason for the discussion if I’m not mistaken is outlined in their first comment:
The current system time has no real relationship to a Page, so it seems odd making it available this way. Additionally, to access the current time in a template, you must have a Page in your context (there are partial template scenarios where the Page may not be in context).
The docs could use an example on how to limit the scope of the new function.
Most Hugo themes that I’m currently seeing either use the deprecated syntax or have the year written manually on the footer.
(Might as well just write the year manually and get over with it. But then again one more thing to remember changing every new year).