r/statichosting • u/Pink_Sky_8102 • Dec 23 '25
How to avoid the update copyright year commit on January 1st?
It is a running joke among developers that the first commit of every new year is just changing the footer from 2024 to 2025. Since static sites generate the HTML once at build time, using a standard Javascript date function might cause a hydration mismatch error in some frameworks. Is there a clean, set-it-and-forget-it way to handle this in the build pipeline so the site automatically stays current without needing a manual update on New Year's Day?
2
u/BlueHost_gr Dec 23 '25
Add <?php date(Y)?> So it change each year on its own?
1
u/Ready_Anything4661 Dec 23 '25
You’re running php on a static host?
1
u/BlueHost_gr Dec 23 '25
You wrote static sites, not static host ;)
2
u/Ready_Anything4661 Dec 23 '25
No I didn’t?
And besides. We’re on the static hosting subreddit. That it’s static hosting can be assumed, no?
2
1
2
u/Top_Shake_2649 Dec 23 '25
Running joke? From what I see, most static sites just don’t care. I still see sites that have copyright year from eons ago. Anyway, in nextjs if you don’t want hydration error just suppress it. I’m not sure of other frameworks, I’m sure they all have their own ways of handling hydration issues.
1
u/zulcom Dec 23 '25
Fix timezone for year calculation both on backend and frontend, no hydration mismatch if build scheduled corrxtly. Or do it on frontend/backend only
1
u/Moceannl Dec 23 '25
Its an example of lawyers copying lawyers. You don't need that statement at all to hold copyright.
1
u/Rschwoerer Dec 23 '25
Even for some odd reason you did, wouldn’t you want the oldest date possible? Claiming you had the copyright first?
1
u/Moceannl Dec 23 '25
Then changing the date to the current year doesn't make much sense. Also anything online can be changed so it's not proof of anything.
1
1
1
1
u/TCKreddituser Dec 23 '25
Already had a lot of great solutions here OP, but I would say changing the copyright year feels almost ceremonial why would you want to get rid of that?
1
u/rikbrown Dec 23 '25
Next 16 + cache components - stick "use cache" on it and let it update when it updates.
1
1
Dec 24 '25
Developers all get copyright wrong. The year is not supposed to be dynamic, it is supposed to be the EARLIEST year that the copyright applied.
1
u/Hot-Profession4091 Dec 24 '25
The copyright date should match the date of the content. If the content has not changed, the date should not change. And if the content has changed, you add to the date, not replace it.
3
Dec 23 '25
[removed] — view removed comment
1
u/soowhatchathink Dec 26 '25
Yeah I think people do it just to show that their site is progressional/has upkeep. I'd say if you have the copyright footer, keep it updated. Or delete it.
1
Dec 23 '25
[removed] — view removed comment
1
Dec 24 '25
There is no way to make JS render the current year, only the year the client computer is set to.
3
u/gwku Dec 23 '25
You can use the following in the footer of Astro for example (replace with something else for your own stack):
That way on each build it's rendering the correct year. The only thing remaining now is initiating the build in the new year. For that you can use something like a scheduled Github Action or your own script, to trigger a new build.