3 ms·
Why have a static site generator when you can just have a CDN?
by EGreg 5y ago
Why have a static site generator when you can just have a CDN?
- Syonyk 5y agoBecause for a lot of use cases, there's simply no need to have a full LAMP (or one of the many various alternatives) stack to serve what should be a simple website. I'm not sure quite what you think static site generators do if you're comparing them to a CDN, but they take a set of scripts, markup, images, and whatever else you care to mix in, and then emit a static site - just a bunch of HTML/CSS/JS/etc. You can host it on anything that supports serving static files - Google Cloud Storage works (especially when fronted by Cloudflare, data bandwidth between those two companies is cheaper), a random old server, etc. You typically render it locally, then simply upload the changes to whatever you're using to host. Not all websites (and not even all websites dealing with somewhat dynamic content such as blogs) need a full server stack, and the security of the server is far better if it's just serving files. I transitioned my blog from Blogger (when they updated it last summer and absolutely ruined the core functionality of their editor, which is editing text) to a Jekyll-rendered site. It works out well, and I simply integrate a Discourse instance I run for a variety of things into the templates to have a functional comment section for posts.
- indigodaddy 5y agoPlease expound on this as if I were an 8 year old.
- EGreg 5y agoYou’re late for school
- stevenicr 5y agoI run a bunch of both. Many sites don't need to be dynamically generated - they just need to provide some text and pics or whatever. Some bonuses with non-dynamic - no worries if a php update fails - no worries if some other server side thing is broken - just serve files - no thinking. Less worries about cpu overload - like having a dozen wordpres sites on a box - you can run into problems if one of those sites is getting hammered by login requests or similar - even if you 100% prevent them from logging in - you are still eating up php and what not which may affect your other dynamically generated sites on the server more than some static files that need to be pushed. Of course you are right in that modern CDNs and cacheing make much of what used to be bigger problems more trivial in general.. A single site on a VPS less likely to be of concern compared to shared hosting or a dedicated box with several sites - in my experience - situations vary.
- ascorbic 5y agoIf you're using a CDN just to a cache a dynamic site you still need a server running, with the asociated costs, maintenance and security issues. With a SSG you really can have just a CDN: build and deploy direct to the CDN and you don't need to keep anything running. The costs and attack surface are much lower.