DEV Community

Cover image for What is a static site generator?

Posted on • Originally published at

What is a static site generator?

The web development industry has found new ways to make the process of maintaining and upgrading sites more successful as websites have evolved to provide more and more content. Years ago, we saw a step away from making large numbers of individual files by hand, to a method where it was possible to include and replicate repetitive parts of code more easily. Whenever a request for a resource is made, web servers can perform the task on demand. Whenever one was requested, they would diligently combine templates and text, add loops and logic and return a page view. And we'd have to make sure they had enough horsepower to keep up with demand, afraid of the popularity of our platform!

Much the same thing is achieved by static site generators (SSG). They apply templates to data and content and create a view of a website that can be served to a site's visitors.

The key difference between a static site generator and a conventional web application stack is that a static site generator does this in advance instead of waiting until a page is requested and then generating its view on demand each time, so that the view is ready to serve in advance. And at construction time, it does so for any possible view of a site.

This has a variety of useful consequences, but most importantly, it moves this work from "request time" (when users request the view) to "build time" which is not connected to when users request a page view. This "decoupled" design breaks the connection between the number of site visitors and the overhead of creating the views for all those visits to be serviced.


Why are static site generators so popular now?

Static site generators got good!

Over the years, the instruments have greatly improved. As we learned what skills were most important for the job of producing tons of website pages, new technologies were especially well designed for those things. And these tools are now very open to developers, which means they can get up and running, be effective, and start creating websites in minutes.

In all flavors, static site generators come with

As the approach started to gain popularity, more and more developers developed tools that better fit their development tastes to work in the language and environment. You will now find site generators based on a wide range of programming languages, use various templating languages and conventions, and work in all kinds of environments. That familiarity generates productivity.

Automation became common

Running the web generator to generate an updated version of the pages is the job of updating a site designed this way. This was cumbersome years ago, but there are many resources now that can automate that assignment for us. The effect is a very powerful and predictable development workflow, but which also generates very stable, pre-generated views as a result.

Top comments (1)

epsi profile image
E.R. Nurwijayadi