Static site generator pros and cons

4 reasons you should use a static site generator—and 4 reasons you shouldn‘t

A long time ago in an Internet far, far away, people built their websites by hand, placing every HTML tag with the loving care of an artisan. They spent the day pondering questions like, “Should I use a <b> or go all the way with a <flash> tag?” 

The first wave of automation to sweep through the server farms swept these tag-slinging humans aside and replaced them with templates that automatically wrapped the words and images in the design of the day. Suddenly the old webpages were said to be “static”—a retronym that showed how dated they were compared to the new, adaptive, and style-forward “dynamic” websites.

Oh how times change. Just as bow ties go in and out of fashion, suddenly “static” is in vogue and the hip coders are discussing it without a hint of sneering condescension. “Static” is zippy and fast. “Dynamic” is pondering, plodding, and slow.

Perhaps someone had time to think while waiting and waiting for the build process to finish transpiling a huge repo filled with an unholy mixture of React, Vue, and Angular? Or maybe someone couldn’t get the database to scale enough to handle the endless queries from the multi-tiered dynamic layer that was constantly pouring the same data into the same blocks on the same pages? Perhaps someone wondered why we were going through all of this trouble just so the webpage could have a little personal greeting in the corner saying, “Bob’s Account”?

The back-to-the-future solution to all of these problems is a static site generator, a tool that is just as complicated as the dynamic sites and pours all of your content into templates in the same way. But it saves the result in a file with the .html suffix, turning the data into static webpages that can be hosted on the same kind of static web server that your grandparents used to host their honeymoon GIFs. You don’t need multi-tiered this or microservice that to connect with the world. You just copy some files and let a basic web server do the work.

There are already a good number of static site generators out there. Jekyll is built for Ruby apps. Next or Gatsby will export React. Many of the dynamic platforms like Drupal have modules that will construct static copies of either the full site or important subsets. There are so many that some developers have built nice curated lists. (See here and here.)

To continue reading this article register now