Wowchemy-hugo-modules: Footer: Auto Update the Copyright Year

Created on 12 Mar 2019  路  3Comments  路  Source: wowchemy/wowchemy-hugo-modules

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.

enhancement

Most helpful comment

To use, add {year} to Copyright option in config.toml. Displays current year.

All 3 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jooyoungseo picture jooyoungseo  路  3Comments

HughP picture HughP  路  4Comments

chris-prener picture chris-prener  路  3Comments

CommonClimate picture CommonClimate  路  4Comments

brianguay picture brianguay  路  4Comments