> I think it makes my website load faster.
You think? What happened to measuring?
Chances are it doesn't load faster at all (not that it matters unless you're in the millions of hits per day). This is because whatever their marketing says, the client still needs at least one more #DNS query before it can request your images.
If you're using a variety of CDNs as many do, it very quickly becomes a joke.
Just serve everything from the same domain.
@0 Not exactly... I use dynamic content on my website *because* I know what I'm doing...
APIs are fun n all, but they can be really fragile (thanks to JS being wonky at times).
Someone didn't enable JS or some of your JS doesn't get executed properly (eg. due to some client-side APIs missing)? Too bad, your site now doesn't load/display correctly.
Also, putting additional strain on the client for that shit is kinda bad imo...
- Scales better: yes, no doubt about that.
- Environmentally friendlier: Depends on the infra, but in general, it's more environmentally friendly to _not_ have it on the clients (especially if said clients are mobile devices)
And with noscript lies a problem...
Because if you run it, I now need to convince you to enable it...
You may do so, but a random person will likely just go: "oh, site doesn't load, kbai"...
@0 Well actually, I see quite a lot of goofballs running NoScript because they heard about it once...
It's like people that still run ABP instead of uBlock Origin...
The load on my websites is about 5k visitors a week, not much but still something.
The only real dynamic content that gets loaded up:
- blogposts (though I am looking into moving these to an API - since these _can_ take a while to load).
- The login status of people (eg. showing "login/register" when not logged in).
@0 No, I see them by literally being there :p
I work in IT and do go from customer to customer (albeit now a bit less due to the covid situation) and see a lot of em running NS.
What I gain by running the load server-side?
Less risk of breakage due to client-side issues.
Financing is done out of my own pocket (with support from donations) but the server runs here anyways so it doesn't cost me a penny more or less.
My blog posts are dynamically generated because of the shortcodes I use.
@0 Yes, Shortcodes.
Basically I type something like `[img src="<url>" caption="Yayeet"]` in my post and my website renders the HTML (adding a card with some content n shizz).
And there you have it, remember that I said: "I use dynamic content on my website *because* I know what I'm doing..." :p
I never said that static-only with an API doesn't have it's place, I said that I don't use it because the "savings" to not outweigh the "expenses".
Also less client-side stress == better UX overal.
@0 Sort of yes, it uses a port of the WordPress shortcode "engine".
The output is 99% constant *however* it may be that the "view template" gets changed (eg. when I added captions to images, then later source references and even later give it a "loading" placeholder).
At which point, the post needs to be re-rendered.
Or if I change the post content at all.
And ofc, different params give slightly different outputs.
At most I can use a cache, but that's basically where it ends.
@0 There is still a need, else I wouldn't have done it ;)
The need: I need to be able to change the rendered output and have it work 100% of the time.
The solution: I use dynamic pages.
Yes, I could use an API for it, but then we get back to the part where JS is iffy af.
I have thought about it for a long time and this is the best way to do it for my situation.
Again, I know what I'm doing.
> You think? What happened to measuring?
Well you are right, I see no difference whatsoever.
I'll disable the CDN usage.
Thanks for reminding me 😅
Mamot.fr est une serveur Mastodon francophone, géré par La Quadrature du Net.