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

Auto-update copyright year during hugo builds #68

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kimlaberinto
Copy link
Contributor

Replace hard-coded 2021 year with "{year}", so that it can be auto-updated during the hugo build process.

"{year}" is updated in layouts/partials/footer.html as seen below with the replace . "{year}" now.Year portion of the code.

<p class="text-sm text-tertiary-text">{{ with .Site.Copyright }}{{ replace . "{year}" now.Year | safeHTML }} &middot; {{ end }} Powered by the <a href="https://github.com/wangchucheng/hugo-eureka" class="hover:text-eureka">Eureka</a> theme for <a href="https://gohugo.io" class="hover:text-eureka">Hugo</a></p>

I believe the footer is the only place where the copyright is shown.

Replace hardcoded year with "{year}", so that it can be auto-updated during the hugo build process. "{year}" is updated in layouts/partials/footer.html.
@wangchucheng
Copy link
Owner

Yes, {year} is just a kind of "syntactic sugar" when I designed Eureka. I did not mention it because I am not sure this is the best practice for now.Year.

I want to find some native Hugo way to do it. And I tried to use now.Year directly but it fails as far as I remembered. If you find how to archive it natively, I am more than pleased to add it.

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

Successfully merging this pull request may close these issues.

None yet

2 participants