r/statichosting • • 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?

14 Upvotes

32 comments sorted by

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):

new Date().getFullYear()

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.

1

u/uhhhhhchips Dec 23 '25

Are people using Astro a lot now?

1

u/gwku Dec 23 '25 edited Dec 23 '25

No idea about other people, but I definitely use it for every website I build if I don't have a reason not to (webapps -> Nuxt, customer wants huge ecosystem -> Wordpress, meh, would rather avoid this).

If feels very light, is fast, very good developer experience, and brings joy back into web development for me :)

Have a look at r/astrojs

1

u/Coz131 Dec 24 '25

I'd like to use it but sadly can't stomach it's supported by vercel. The CEO is a massive Zionist.

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

u/lapubell Dec 23 '25

I just upvoted for the lols

1

u/GreenRangerOfHyrule Dec 23 '25

If the code doesn't change then is that not static?

/s of course

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

u/Rschwoerer Dec 23 '25

Yea, no, I totally invented that website in 1954, yea that’s my copyright.

1

u/WinkMartin Dec 23 '25

change it a few days before you close for the holidays.

1

u/motific Dec 23 '25

Just update the copyright year when you update the content?

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

u/Adorable-Strangerx Dec 24 '25

Just run scheduled pipeline? How is that even an issue in 202x.

1

u/[deleted] 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

u/[deleted] 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

u/[deleted] Dec 23 '25

[removed] — view removed comment

1

u/[deleted] Dec 24 '25

There is no way to make JS render the current year, only the year the client computer is set to.