Liara

According to the git commit logs, I moved over to Hugo as the static site generator behind my blog here on December 29th 2016. At the blog’s rebirth in 2011 I originally chose Jekyll, which is similar in philosophy to Hugo but is written in Ruby. It used to be a whole ordeal to get and maintain a functioning Ruby on a FreeBSD system, which is what I’ve used as the server OS for my webservers since at least that 2011 epoch of my modern writing, so switching to Hugo, which is written in Go, brought me a single static binary and therefore a much easier deployment model.

It also brought much faster performance, building my blog and its small handful of posts in about 50ms. It sometimes felt like it took an order of magnitude longer than that just for the Ruby interpreter to get itself ready to start executing code, never mind fully generate the entire blog.

Hugo has a tendency to incessantly change its templating system however, which became a chore to keep pace with. I didn’t have to do that and could have stuck to a version that just worked, especially since the output is a purely static site with no Javascript and minimal page weight, with simple markup and styling.

Instead, I’ve done what any endless tinkerer and enjoyer of technology would do: I’ve switched to something else! What static site generator could possibly improve on Hugo’s single static binary, executing native code without any external dependencies, and which does the entire job of generating my blog in less time than a human blink?

Enter Liara, written by a great friend of mine: Matthäus Chajdas. That written by a great friend bit is one of the major benefits of heading in Liara’s direction since, given all the talk of content generation performance with a single static binary to deploy anywhere that needs to create the site, it could be seen as a step backwards.

Liara is written in Python, which brings with it a pain of system deployment that the Python ecosystem doesn’t seem to ever want to truly solve, despite much-improved modern tooling for managing it on a system like uv. It also comes with a performance hit, generating an equivalent site on the same hardware as Hugo in ~490ms (both from a cold cache).

Having to change where Liara runs to create and deploy new builds from was relatively painless however, and I clean build the site a few times per new post at best, so the generation speed hit barely registers when accounted for alongside the glacial pace of me thinking about what words to type.

Like Hugo, Liara has a mode where it watches for changes to the content on disk as you’re writing, building a version of the site for you to easily reload in your browser and preview as you author. That helped immensely when authoring the changes to bring the content, markup and styling into a working form from their Hugo equivalents.

Porting the content was the easiest part. Liara renders Markdown input to HTML output like Hugo does. In fact, they consume almost identical Markdown documents as input, so the main things to tackle there were making sure all of the Hugo templating logic I used was moved to equivalent functionality in Liara, or reworked so it wasn’t needed any more. Liara also supports shortcodes, which let you write small bits of Python to do interesting things during HTML content generation that Markdown alone can’t do, which is something I leaned on a bit with Hugo.

After that I ported the CSS “compilation” phase I had in Hugo to Liara’s SASS-based approach, in order to get the markup styling working. All I really did there before was ask Hugo to concatenate a few different CSS files together into a single stylesheet document. In SASS speak that’s just @use-ing those separate files in a single SASS document, so the SASS compiler can turn those into one associated CSS output document.

Lastly, I needed to find an equivalent code snippet highlighting system for the handful of posts I have with a bit of readable code in them. As luck would have it, Matthäus is a maintainer of pygments, the Python syntax highlighter that Liara uses. It really helps when your site generation engine’s syntax highlighter library are written and maintained by the same person, because I got stuck a little working out how to get pygments to do what I wanted from a CSS perspective.

As you can see, I’ve changed the blog’s colour scheme to something very similar to Dracula, a favourite app theming system of mine, as part of this rework for moving to Liara. That meant I had to rework the syntax highlighter style that Liara would pipe into the resulting CSS document. Thankfully, due to its popularity, pygments already supports Dracula as a built-in theme style, and my struggles and the resulting advice with how to use pygments properly turned into new syntax highlighting documentation in Liara.

Hopefully that’s useful for anyone else that wants to pick up Liara as the engine behind their own blog.

That’s something I encourage everyone to consider if they’re looking for a static site generator to publish a typical multi-page structured website like this. Liara will feel familiar to anyone that’s coming from or has looked at Hugo, Zola, Jekyll or something similar. In particular, the way you author, template and generate content with it is attractively conservative and doesn’t change in big breaking ways every other release as Hugo seemed to do. Performance is good and liara serve for interactive previewing while authoring is excellent.

Most importantly, the help you’ll get if you get stuck or inspired to ask for tweaks or new features after using Liara, or reading its first-class documentation and source code, is first rate. There are hundreds of systems out there like Liara, so be sure to bubble it near the top of your list when you’re trying to decide which one to pick next.