InfinityFree front page year unchanged

First, Happy New Year to everyone!
Secondly, the InfinityFree front page has a small year issue.
image
Now it’s already 2024.
Happy holidays to everyone!

3 Likes

remove the fixed text and add some php code to display the server year :stuck_out_tongue: :rofl:

5 Likes

Or use JS :sweat_smile: :upside_down_face:

3 Likes

how would i do that?

You can use Javascript to dynamically set the year using this new Date().getFullYear(); function.

For exapmle i created this script to change my website’s year dynamically.

let gtm = new Date().getFullYear();

function exon() {
  dt.setAttribute('data-dt', gtm);
}
exon();

function dtex(){
  let dtl = dt.getAttribute('data-dt');

  dt.innerText = dtl;
}
dtex();


3 Likes

Hmm, I thought I fixed that. But apparently I didn’t.

I thought I had setup an automatic pipeline that runs on January 1st just after midnight that rebuilds and re-publishes the site with the new year. The date is actually dynamic, but only in the site generator, the site itself is completely static.

And having dynamic code to that calculates the year on every request seems a bit unnecessary for something that only changes once per year. Especially if that would be the only reason to have server side rendering.

11 Likes

Oh i haven’t thought about it. I’ll set it to only be executed on January 1st.

3 Likes

Maybe you had it back when you were using Jekyll
and when you changed the website (design + hugo) then you forgot about it

10 Likes

Unless most of your page has PHP code, then I don’t see the point in doing that.

PHP would probably be better because you only need to use one line, whereas Javascript would take multiple.

The year is <?= date("Y") ?>!
7 Likes

I also noticed that, with the new change, the website’s font is also broken!

8 Likes

Yes except that means consuming a bit of server power to calculate it when you want it to spit out static web page (which is done without executing anything)

7 Likes

Thanks, I hadn’t noticed yet!

I enabled CSP on the main site today based on older config, but it had an incorrect font-src which didn’t allow the current Google fonts. That’s fixed now.

11 Likes

No problem, I just had to point it out! Anyway now the fonts load as usual.

9 Likes

True. But my page is a static one :wink:

5 Likes

Then use JS. JS is very good for this case and it can work more flexible.

There is really no need to bloat the web page a little just to make it change something that happens once a year, really.

4 Likes

Hi YT_Xaos,

There’s a bit of difference between PHP and JS for copyright year due to different clocks being used as reference.

PHP is definitely server-time based, and while you can guess the user’s geographical location by IP address, you could still be misaligned to the user’s timezone or be completely wrong if you simply converted the year based on that. Usually, websites that go with PHP are server-time oriented and have the time set to follow the company location.

JavaScript on the other hand gives a more customized user experience and caters to all users of all timezones, as they are the ones keeping their clocks accurate. However weird cases like some dude setting the clocks years ahead or before (probably for Candy games) and will see an odd year displayed.

For hosting company like IF, definately PHP as that’s what reflects the hosting location and the company location. For blogs tho, either solution works depending on the web admin’s niche.

Cheers!

1 Like

It really doesn’t matter what you use to update the year. Quite frankly, most users will either not notice or not care.

Yes, exactly.

6 Likes

change the copyright year to the infinity symbol, problem solved :rofl:

8 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.