Dirk's Tech Findings

DynaHTML/Lektor: Why I use static site generators

Publication date: 2020-05-12

The widespread way of doing things

Most people use a popular content management system (CMS) like Wordpress to create and maintain blogs and other kinds of websites. In such a setup, the site content is rendered dynamically on server side, e.g. using php. The author can access the site via an admin frontend (from anywhere) and edit the site, e.g. add blog posts.

What's the catch with it?

However, this popular approach comes with some drawbacks. The biggest one is security. CMS applications have a big and complex code base. Security vulnerabilities are found regularly. Even with updates installed regularly, sites cannot be considered secure and non-hackable. The next drawback is convenience. CMS applications have short release cycles, and on every major update, one needs to check on the compatibility of the web server environment, themes, plugins, etc. Not everybody wants to use his time for such tasks. Finally, rendering the web pages dynamically is often not needed since most content is static and does only change when the site is edited or blog posts are added. This makes the web site unnecessary slow and is a waste of resources.

The alternative

The described drawbacks can be avoided for (semi-)static content by using so called static site generators. These are tools to render web pages on update/request only and store the resulting content as static html/css/etc. The static content is then published to the web server. In this case, the web server only needs to deliver static content (unless it is mixed with dynamic content on purpose). There are many of such static site generators, for example “Pelikan”.

I personally like and use DynaHTML (php) and Lektor (Python). Lektor even has a simple admin frontend using which content can be administered, e.g. blog posts be added, reviewed and published. This blog is created using Lektor.

Back to topic list...