The basic principles, advantages and disadvantages behind static site generators and their technology

May 22, 2015 13:12 GMT  ·  By
Static site generators are a new technology that has made publishing a website much easier and faster
2 photos
   Static site generators are a new technology that has made publishing a website much easier and faster

Static site generators are over-glorified template engines that produce a static HTML website that's ready for user consumption right away. There are a bunch of them available online right now, in any programming language you can think of.

The principles behind such tools are simple, and they have been used since the early '90s to produce simple HTML websites, the only difference is that people didn't call them “static site generators.”

Their rise to fame came in recent years when, due to WordPress' expanding feature set and codebase, most bloggers started looking for simpler alternatives for publishing their rants.

Solutions like Jekyll, OctoPress, Pelican, Hexo, Middleman, DocPad, and PieCrust provided them with a simplified publishing system, one that didn't bother with admin panels, multiple users, and sometimes even comments.

The main advantage is simplicity

The concept behind a static site generator is as follows. The codebase is made up of three main parts. The first part is the template files where the site's layout is stored, with special placeholders where content blocks will be inserted. The second part is the content files (usually Markdown or JSON), which are broken into smaller sections themselves, for storing information about the author, the page's meta, and the content itself. The third and final part is the static site generator's guts, the code that breaks down the content files, inserts them in the templates, and then renders a static HTML page with the proper JS, CSS, and image files to go with it.

The advantages of using such a technology are plenty, with the most important being the speed at which static HTML websites are served to users compared to their PHP, Python, Ruby or Node.js counterparts. The best comparison for static site generators is someone taking a rock off the ground and throwing it, while the classic way of compiling and serving a website is someone taking a chisel and hammer, breaking a big stone into smaller pebbles and throwing one of those at you. It's immensely faster, simpler for the server and works fine even without caching extensions.

Most static site generators also come with an easy way of configuring them, usually via an appropriately named “config.extension” file that holds all the options in one single place. Part of them also come with a very basic HTTP server built-in, so in most cases developers can even deploy them from any computer with Internet access, not just via Apache, NginX, or a shared hosting provider.

Most static site generators work from a command-line interface
Most static site generators work from a command-line interface

The biggest disadvantage is … geekiness

Unfortunately, there are some drawbacks to this technology as well, mainly when it comes to business usage, most clients requiring an admin panel to change their content. You don't have to be a genius to know what happens when you tell a client to connect via FTP and edit a specific file from a specific folder using Markdown, HTML, Textile, or other special formatting markup. It generally never ends well.

So unless the client's site gets very, very rare updates which you can handle on your own, using static site generators for client work requires some pretty geeky clients to begin with.

Another potential disadvantage we may list here is the fact that compiling a new version of the website and putting it live sometimes requires command-line interaction. Fortunately, we tested some newer static site generators here at Softpedia in the past, which automatically recompiled the final website when changes were being made to content or template files. So there are alternatives to CLI-based generators if you have the patience to look for them.

Also in this category we could have listed extensibility, but in recent years tools like Jekyll and Octopress have also started supporting plugins, a useful feature for supporting quirky features developers don't want in the generator's default codebase.

Overall static site generators can be considered a success story in today's Web development market, rising up to take over a niche left open by WordPress in the past few years, which we also noticed here at Softpedia, our Webscripts section containing a dedicated category for Static Site Generators for a few months now.

Photo Gallery (2 Images)

Static site generators are a new technology that has made publishing a website much easier and faster
Most static site generators work from a command-line interface
Open gallery