Get Static
Published 4 years, 8 months pastIf you are in charge of a web site that provides even slightly important information, or important services, it’s time to get static. I’m thinking here of sites for places like health departments (and pretty much all government services), hospitals and clinics, utility services, food delivery and ordering, and I’m sure there are more that haven’t occurred to me. As much as you possibly can, get it down to static HTML and CSS and maybe a tiny bit of enhancing JS, and pare away every byte you can.
Because too many sites are already crashing because their CMSes can’t keep up with the traffic surges. And too many sites are using dynamic frameworks that drain mobile batteries and shut out people with older browsers. That’s annoying and counter-productive in the best of times, but right now, it’s unacceptable. This is not the time for “well, this is as performant as our stack gets, so I guess users will have to live with it”. Performance isn’t just something to aspire to any more. Right now, in some situations, performance could literally be life-saving to a user, or their family.
We’re in this to serve our users. The best service you can render at this moment is to make sure they can use your site or service, not get 502/Bad Gateway or a two-minute 20%-battery-drain page render. Everything should take several back seats to this effort.
I can’t tell you how best to get static — only you can figure that out. Maybe for you, getting static means using very aggressive server caching and a cache-buster approach to updating info. Maybe it means using some kind of static-render plugin for your CMS. Maybe is means accelerating a planned migration to a static-site CMS like Jekyll or Eleventy or Grav. Maybe it means saving pages as HTML from your browser and hand-assembling a static copy of your site for now. There are a lot of ways to do this, but whatever way you choose, do it now.
Addendum: following are a few resources that can help. Please suggest more in the comments!
- Emergency Site Kit: “This project aims to enable people to quickly publish a simple website that can withstand large amounts of traffic and will work even under extreme conditions. It is built on the rule of least power, using simple technologies for maximum resilience.”
- FastCGI Cache for Nginx.
- Sitesauce is offering free accounts for critical sites impacted by the pandemic.
Comments (17)
For fast deployment to convert all or most of a site to serve a majority of page visits as static caches pages from a global CDN look at Clouldflare, even using their Free plan, and implement a Page Rule as talked about here:
https://support.cloudflare.com/hc/en-us/articles/360021023712-Best-Practices-Speed-up-your-Site-with-Custom-Caching-via-Cloudflare-Page-Rules
If you are WordPress powered, here are some specific instructions: https://support.cloudflare.com/hc/en-us/articles/236166048-Caching-Static-HTML-with-WordPress-WooCommerce
If you are Craft CMS powered considered using a plugin like: https://plugins.craftcms.com/blitz along with Cloudflare.
Not only does this move all more most of your site to being static serviced, but also cached and served from a global network of 150+ data centers, and again all of this works even with Cloudflare’s Free plan level.
You can use
wget -r
to download you web page recursively. There are also more options for domains allowed to visit recursively, relative links in the HTML, etc. Doesn‘t work with very dynamic Single Page Apps though.Pingback ::
Get Static – paulfosterdesign
[…] Get Static, meyerweb.com […]
Pingback ::
Get Static – Roel van der Ven
[…] Eric Meyer captures it nicely I think: Get Static. […]
Your site isn’t static why should we listen to you?
Brian, three reasons:
And finally, even if none of the above were true, good advice does not require a lived example. So even if meyerweb was a client-side-rendered site pulling content out of an overloaded CMS to serve critical information to the general public, the advice would be worth listening to. Never let purity get in the way of growth.
Exact words for why I do what I do. We need more people working in this direction. Thanks Eric!
Solid advice! I agree, now is the time to keep crucial pages fast and simple. CMSes empower the publisher, but they’re often implemented at the expense of the user. Our current situation only highlights those CMS-triggered issues.
It’s funny. I first found your blog landing here: https://meyerweb.com/eric/thoughts/2007/04/18/reset-reasoning/ and I thought wow, this guy must be an authority now, after 13 years, he must be into something really sophisticated. 2007 and already busy with ie7 and css hacks and that stuff. And then I looked for your latest post, and you recommend to go static and stop using dynamic technologies to save battery .. cool. I really liked it!
Couldn’t agree more. That’s the reason I am/was a long time fan of Movable Type’s approach of generating static HTML files that can be rsynced to the prod sever :)
Stay safe and healthy Eric.
For the record, Grav is not a static site generator. It just uses flat files as the data store instead of a database. Actual page loads are dynamic and require PHP, unless you do something nonstandard like exporting the website to static HTML.
https://www.phase2technology.com/blog/grav-cms-is-not-a-static-site-generator
One thing you didn’t mention is that running statically can save money for these often cash strapped vital services. You can serve tens of thousands of hits per second on the cheapest EC2 server or for free on Github or an S3 bucket (well almost free). But run a CMS without caching and you’ll be bumping up the server specs massively to cope – both the web sever and the database server. This can be a huge expense.
In addition, the security risks CMS can open up if not well managed is not worth it, especially in a critical scenario that these vital services are there for. A static site has dramatically less vectors of attack.
Pingback ::
March 27, 2020: My Weekly Roundup of Web Design and Development News
[…] information and resources from healthcare and government sites, it’s time for those sites to get static, says Eric Meyer. Sites using content management systems (CMS) are crashing from the surge in […]
I couldn’t agree with you more. OK, I’m obviously biased as Forestry.io offers a git-based CMS on top of static site generators storing content in Markdown and data (JSON, YAML, TOML) files. We don’t really care if you prefer to use Hugo or Eleventy. We only care about making sure we commit back your content changes back to your repo.
While the Git flow is very handy for developers (pick up your favorite front-end tooling and auto-deploy on every push on a fast CDN allowing your site to scale without thinking about performance and security), it can be hard to embed your editorial team, especially when they’re used to tools like WordPress where they only have to worry about content. It’s the gap we try to fit.
They’ree plenty of API-based tools, but we find the git-based approach to be simple and efficient. The whole team shares a common workflow, you even could take advantage of Git features like branching, reviews, etc. The same workflow that proved to be very efficient for developers happen to be also very handy for editors.
Back to the old skool way of working. Simplicity does the job.
You inspired us. We at Strattic are now offering free static hosting to WordPress websites providing important and useful information related to Coronavirus / Covid-19.
More info here: https://www.strattic.com/covid-19-static-website-hosting/
Pingback ::
Adactio: Journal—Lightweight
[…] Eric emphasises the importance of performance in his post Get Static: […]