Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic copyright year #71

Open
jsumners opened this issue Jun 15, 2023 · 2 comments
Open

Dynamic copyright year #71

jsumners opened this issue Jun 15, 2023 · 2 comments

Comments

@jsumners
Copy link

jsumners commented Jun 15, 2023

I'd like to have the copyright year calculated automatically. To that end, I have followed an article to modify the footer.html like so:

5c5,8
<                 <h6>{{ if .Site.Copyright }}{{ .Site.Copyright | markdownify }} | {{ end }}
---
>                 <h6>
>                   {{ if .Site.Copyright }}
>                     {{ replace .Site.Copyright "{year}" now.Year | markdownify }} | 
>                   {{ end }}

Which means in my config.toml I can have:

copyright = "Copyright ©{year} James Sumners. All rights reserved."

This, of course, has the desired effect. However, as with #70, this means I have to keep track of when footer.html changes upstream and sync changes manually. I haven't really come up with a good solution for this. Do you have an ideas on how we could solve this?

@funkydan2
Copy link
Owner

I haven't looked into the documentation for the replace function, but I assume this would be a non-breaking change?

If so, I'd be happy to consider a PR that included this change along with appropriate documentation (maybe a comment in the example hugo.conf).

@jsumners
Copy link
Author

🤔 I'll research it soon. It could be that replace does nothing if the token is not found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants