Static Site Generators

Static Site Generators

There is more and more focus on the performance of a website, and the effect performance has on search engine rankings. Performance is the first metric loaded by Google's lighthouse audit. The obvious reason why this is the case, is that Google wants to get the information to users as fast as possible.

The ultimate goal for any website is to get 4x100 ratings across the lighthouse audit, both on desktop and mobile. Getting to that rating isn't always easy. Performance is the hardest to hit (in my opinion).

At the time of writing, the performance metric for my website homepage was sitting at 91/100.

Lighthouse audit rating for visitors on desktop devices 91 for performance, 100 for the remainder
Lighthouse audit rating for visitors on desktop devices

On mobile, the story is different. It's a much lower at 75/100.

Performance drops for 75/100 for mobile users visiting my site homepage

Where's the Bottleneck?

The slow part of most sites is due to the Content Management System (CMS) in the background. A lot of the time taken for a page to load is the communication between the CMS code and the database. In a lot of cases this requires requests across the network to communicate with the database. The returned data then need to be processed to generate the page content, which can then be returned to the user. Each of these steps takes time.

This website is (at the time of writing) using a CMS, which has the performance drawbacks. Even once caching and Content Delivery Networks (CDNs) are brought into the mix.

If you can remove some of those steps, then the speed of the site will naturally improve. This is where a static site generator comes in.

These remove the requirement to perform some of the steps. Specifically any of the database and processing work. It does this by building the page once, and storing it as a html file on the web server. This means the visitor is served the information they requested directly, because the page which would be built from the CMS at each request is already generated in full.

There are a lot of options out there if you want to use a static site generator. A list of 314 (probably not even comprehensive) is available on the jamstack website. I'll be taking a look at a few of the PHP based ones in a future edition. For now, I'll let you go and marvel in amazement at how many options there actually are for static site generation (and that doesn't count hand-crafting the HTML).