What Are Static Site Generators?

The simple technology behind some of your favorite websites

In the early days of the web, pages consisted of simple HTML and CSS. Web pages weren't dynamic programs, and there weren't extensive databases behind the pages. As a result, it was cumbersome and time consuming to update a site or apply new styles. To solve the problem, developers used programming languages like PHP to make websites. Websites transformed from simple HTML affairs to full-blown applications.

Static HTML

Dynamic Websites

With a dynamic, program-based website, content generates using the code, and there's no need to code every page individually. All the important information is stored in a database, and the program plugs it into each page where appropriate. In most situations, it's more efficient and easier to manage.

For simple sites, though, a dynamic website is unnecessarily complicated. If you only need a simple page or two that display information about your business, a complex web platform is excessive. Then there's the speed factor. Simple static sites are quicker. Nothing is going on in the background. It's just simple HTML. So, static sites are fast in comparison.

Why a Static Site Generator?

What happens when you want the benefits of both a static site and a web application? That's where a static site generator comes in. Instead of having a web application running on your web server constantly, use a static site generator to dynamically create your site and all the static pages in it. Then, upload the files to your server, and everything's set. Your site is still dynamically generated, but it's dynamically generated once before you put it online, instead of each time someone requests a page.

Jekyll static site generator creating a simple site

Static sites generated with a static site generator are faster than dynamic sites. These sites require fewer server resources to run and can handle more traffic.

Static sites are also more secure than dynamic sites and require less maintenance. As with any computer program, a web application like a dynamic website suffers bugs or security flaws. These flaws are behind a decent amount of the famous data breaches in the news. WordPress is the most popular dynamic website platform, and it's also a favorite among hackers. Static websites don't have a program to exploit or a database to break into.

Popular Options

Static site generators have grown in popularity. There are dozens of common options, but a few stand out as favorites.

Jekyll is popular, and it's been around longer than most. It's written in the Ruby programming language—the same one that gave rise to the popular Rails framework—and it features its own convenient templating language to simplify the creation of your pages. If you're looking for somewhere to start with static site generators, Jekyll is a great place.

Take a look at Hugo, Nuxt, Gatsby, or Wintersmith, too. These are popular options and offer features similar to Jekyll with their own spin. These static site generators are free and open source.