Introduction to Static Site Generators

Peter Thaleikis

Engineer. Maker. Open Source Fan. Backpacker

by Peter Thaleikis

Even in 2019 many developers are used to spinning up a WordPress (or similar software) for content websites. Until recently I've been one of these developers. I was willing to develop a website using technology to get done what I could get done without. My choice of framework wouldn't have been WordPress, but at the end the result is the same: building a system to deliver what a static publishing software could have handled easily. In many cases it simply isn't worth the effort to set up, configure and maintain a fully fledged content management system and store content in a database.

2019 is the year of the static generator. Get your blog started today!

What is a Static Site Generator?

A static site generator (also called static publisher) is a program, that generates a complete website as an output. The generation can either be done locally on your computer or on a webserver during deployment. The website is then served through your web server — just like the old’n’days.

Content is typically written in a template language like Markdown or Liquid. This allows you to concentrate on your writing and ignore the layout and styling of your content. Some static generators allow you to mix and match your templates using PugJS, Markdown and others at the same time. Being a statically generated website, you'll have your content in a readable format on your computer available at any time. Should you wish to re-use it or re-publish this means very effort finding and reworking your own content.

As no database (besides the filesystem) is used no SQL or extracting addons/plugins are used. This makes your website deployment more stable and robust. With GitHub and co. you can also edit your website on the go and deploy simply by committing new content.

Why using a Static Site Generator?

What are the limitations and what workarounds are there?

As with any technology, there are cases where it's more suitable and useful than others. Same goes for static site generators of course. Here are some cases where you might want to consider a different approach. For most issues, there is a simple workaround nowadays. Conveniently suggestions for these workarounds are listed with the issues below.

Most limitations can be avoided or mitigated by having a clear separation of your frontend and backend. This allows you to consider hosting your frontend as a static site and doing the heavy lifting on the backend (if needed at all).

Which Static Site Generator should I choose?

There are many static site generators out there to select from. Your decision depends more on preference for frameworks than technical differences. My personal favorites are:

Summary

I’ve found the main advantage of using a static site generator to be the ease of getting things up and running. The effort for set up and configuration is very low. You can get started writing the same day. It's stable and scales very well — perfect for production websites. Using a static generator is highly recommended and has suited my needs and skills perfectly. This being said, I'm sure non-devs will find their way around as well. Some understanding of HTML and CSS is recommended for any online project you are doing at the end. I encourage you to look around, try a few static site generators out to find the one that best suits your needs.