This page is part of my digital garden.

This page might be unfinished or have typos. These pages are meant as part of a public living notebook to be edited over time. For more, visit the page explaining the concept of a digitial garden.

Static Websites

“Static Websites” are websites made entirely of static files. They’re usually made by writing content in text files which are run through some program to turn them in to a set of html/css/js files to serve on the web.

Static sites are different than your usual site because they do not run any “code” on the server and because of that they can be safely hosted by others at scale like AWS S3, Netlify, Vercel, Firebase, and etc.

Why to make a static site

Static sites have become very popular because they’re cheap and easy to maintain.

  • Cheap
    • Static sites are small and storage is extremely cheap (near zero)
    • “No code” means the hoster doesn’t need to worry about tightly isolating tenants and can share more of a server to host many users.
    • Serving static files is low-compute and a large server serving many websites can more easily handle serving spikes of traffic for less than a server you run and configure yourself.
    • Using files to store the content means not needing a database nor maintaining or scaling that database during traffic spikes (“Hug of Death”)
  • Secure and Low Maintence
    • No database means it can’t be attacked/compromised/etc.
    • No code means the website itself doesn’t have anything to exploit
    • Because the server just needs to serve static files it can be locked down more extensively than a typical website is locked down.

Given how cheap, secure, and low maintence static sites can be it’s no wonder they’ve become increasingly popular since Github announced Github Pages and Jekyll in 2008.

That said let’s go over some reason to not use a static website and some nuances of how people actually use static websites today.

  1. Static websites require a “generate/compile” process which for some SSGs can take a long time (namely jekyll the OG).

Static Site Generators

While you could make your own static site by hand it would be difficult to maintain. A lot of the reason “static” websites went out of favor initially was that dynamic websites made it easier to maintain many pages consistently.

Static Site Generators (SSG)1 like Hugo[^this-side-uses], Jekyll, or Gastby let you choose a theme and write content in text files that can be used to generate the HTML that actually gets served to users. Because they use text files for the content you can now manage your content via something like Git, Github, and Pull Requests.

List of (some) Static Site Generators:

  • Hugo
  • Jekyll
  • Gastby
  • Next.js[^next-js]
  • E11venty
  • Pelican

Hosting Static Sites

Today’s computers, operating systems, web servers, and internet connections can handle a lot of data.

Static sites on the other hand usually are not actually that much data. An excellent example is a personal blog which often has less than a couple thousand pages and is not updated often (less often than every minute. often once a month or two).

  1. Not to be confused with “Server Side Generated” or more commonly “Server Side Rendered (SSR)” which refers to pre-rendering what a React/Angular/Vue site should look like before it hits the browser. ↩︎

Last updated on