Can the copyright message in the footer be enabled to display the current year dynamically?
Change line 9 in layouts/partials/footer_section.html using a token, such as {currentYear} that is searched and replaced:
{{ with .Site.Copyright }}{{ . | markdownify}} · {{ end }}
to
{{ with replace .Site.Copyright "{currentYear}" now.Year }}{{ . | markdownify}} · {{ end }}
and have the copyright text display in config/_default/config.toml display something like:
copyright = "© 2010 - {currentYear} My Name"
The user can choose not to have {currentYear} in the copyright text or leave it blank.
Hmm...appears that Hugo team have no plans to support Go variables in front matter (due to performance reasons): https://discourse.gohugo.io/t/using-site-variables-in-front-matter/7928/14 .
We can consider adding our own template variable in one of the next versions, similar to that which you suggested.
To use, add {year} to Copyright option in config.toml. Displays current year.
Thanks a lot!
Most helpful comment
To use, add
{year}toCopyrightoption inconfig.toml. Displays current year.