TheBlackzone Logo

Changing the content creation workflow

Posted on Friday, January 4 2019

Today, for the first time in over 10 years, I changed the way the content of this site is created. As of this post, theblackzone.net is running on static HTML pages again, which are created by a toolchain you may encounter not that often...

In many of my previous posts related to my website, I mentioned that I used the Habari weblog system to run my site. Actually I used it for quite a long time (since 2009) and I was very satisfied with it. Unfortunately the software is no longer under active devlopment and all signs suggest that the whole project is dead.

Since the release of version 0.9.2 in 2014 there had not been any updates to Habari, no new announcements had been made, there were no new tweets, the developer mailing list is deserted and there is no recent activity on Habari's project page on github.

Now, this doesn't mean that the software has suddenly become unusable. In my experience the current version runs stable and it has all the features I needed. But since there is no active development it is just a matter of time before the next PHP upgrade might break the software. In fact, doing a test installation on my Linux notebook with PHP 7 threw numerous errors at me.

With that in mind I started looking into some alternative blogging solutions, just like I did in 2008. As it turned out, most of the solutions I had checked at that time are meanwhile defunct or outdated. Others are too heavyweight (Wordpress) or just not my cup of tea (any of the third-party solutions and online services).

One of the packages I had a deeper look into was Serendipity, which looked quite promising. But after investing some time I found that it lacks features that I was used to and I felt its templating system to be just plain horrible.

I had also looked into some of the static site generators as I was previously already thinking about using one of them.

But, admittedly, my recent research in alternative blogging solutions was more driven by interest to see whats currently "on the market" and the technical aspect rather than by a real necessity of finding a replacement for Habari. Using a full-featured blogging system for my site has never really been a hard requirement, it has been more of an experimental side product.

Ultimately, I decided to run on good old static HTML pages again.

Already in 2017 I had created a set of shell scripts that where basically functioning as a poor man's version of a static site generator. They took Markdown files as input and converted them to HTML using the Pandoc document converter.

After experementing with this system for a while, it started to bug me to write a mixture of Markdown and HTML, which became neccesary on more and more occasions due to the formatting limits of Markdown.

Then, on another occassion that was completely unrelated to authoring my website, I was looking into the GNU m4 macro processor. After creating my first macros with it, it was quickly obvious to me that it would be a perfect match for creating web pages as well.

So I rearranged my toolchain. Instead of taking a source file in a foreign format (Markdown) and translate it to HTML, the source file was now HTML containing macros that expanded to blocks of HTML during processing.

To give you a brief idea what I am talking about, here is a simple macro definition:

define(`_figure', `<figure><img src="$1" alt="$2" title="$2"><figcaption>$2</figcaption></figure>')

This creates a <figure> block containing an image and an image description. Thus, whenever I write

_figure(picture.png, This is the picture description)

in my file, it expands to the following HTML code when it is processed:

<figure><img src="picture.png" alt="This is the picture description" title="This is the picture description"><figcaption>This is the picture description</figcaption></figure>

You can easily scale this to any complexity and even have recursevely expanded macros.

After having created a set of macros to fit my needs, I rewrote two of my former shell scripts to create some of the "dynamic" content, eg. the "latest posts" on the front page.

So far the new workflow has turned out to work quite well and it feels great to have a working system with no dependencies on server side techniques which makes the site immune to configuration changes by the provider and possible security issues due to outdated software.

But of course, there is also some melancholy in abandoning Habari after such a long time. I hope that the Habari developers will revitalize the project one day. It definitely deserves a future.

Tags: website