Description
The footer currently uses {{ 'now' | date: '%Y' }} to display the copyright year. Since the site is statically generated via Eleventy, this value is "frozen" at build time. If the site isn't redeployed on or after January 1st, the year becomes outdated for visitors.
Suggested Solutions
I’d like to propose two ways to fix this behavior:
-
GitHub Actions Scheduled Build (The "Static" Way):
If you prefer to keep the HTML pure and avoid client-side scripts, a scheduled workflow could be added to .github/workflows/. This would trigger a fresh build automatically every January 1st:
on:
schedule:
- cron: '0 0 1 1 *' # Runs at 00:00 on Jan 1st
-
Client-side JavaScript (Set it and forget it):
Replace the Liquid tag with a small span and a script to ensure the year is always current based on the user's system clock:
© <span id="year"></span> 37signals
<script>document.getElementById('year').textContent = new Date().getFullYear();</script>
Both approaches would prevent the year from falling behind in the future.
Best regards,
Lucas
Description
The footer currently uses
{{ 'now' | date: '%Y' }}to display the copyright year. Since the site is statically generated via Eleventy, this value is "frozen" at build time. If the site isn't redeployed on or after January 1st, the year becomes outdated for visitors.Suggested Solutions
I’d like to propose two ways to fix this behavior:
GitHub Actions Scheduled Build (The "Static" Way):
If you prefer to keep the HTML pure and avoid client-side scripts, a scheduled workflow could be added to
.github/workflows/. This would trigger a fresh build automatically every January 1st:Client-side JavaScript (Set it and forget it):
Replace the Liquid tag with a small span and a script to ensure the year is always current based on the user's system clock:
Both approaches would prevent the year from falling behind in the future.
Best regards,
Lucas