[onnilampi.fi] [blog] [keys]

Small updates to the site tooling

12.09.2026

In the past, this blog hasn't been too image-heavy. This is probably not changing in the future, but still, only adding a few images proved to be a bit cumbersome with the existing tooling. To help with this, I created a simple macro that can be called to template an image in a neat fashion.

A git diff showing how the macro makes things neater and moves much of the repetative boilerplate into the template internals.
Example from the template of a previous post.

In addition to making the image inclusions a bit easier, the templating macro also allows for adding additional validations. One of the most important design principles for me in this website project has been to ensure that a successful site generation means that things are at least not horribly broken. It is better to fail the site generation if there is a risk of including broken links to the site's own content, for example. For the images, there are three rounds of validations:

  1. Each image must be explicitly declared in posts.yml. These declarations are then easy to check and make sure that for each image, there is a corresponding regular file present at the location we expect it to be.
  2. Once we at least know that each file exists, we check that when the macro is called, the image passed as a parameter is a part of this validated list of paths in a post-specific manner. The post templating will fail in case the macro is called with a non-existent image name.
  3. Finally, the paths are checked again after the site artifact is generated. This is to make sure that copying the files to the artifact was successful.

An additional improvement was the inclusion of a Makefile, which automates several operations related to the site development. It's not like having to run a few playbooks every now and then is that hard, but it is neat to simply type make watch into a terminal and have the site be automatically generated when updates are saved to local disk. In addition, there is a separate instruction set for generating the real site, which will in the future be expanded with more instructions on how to create a version of the site to be served in other means than the traditional internet. Currently, I'm mainly looking into making the site available through Tor and sneakerweb.

Update 13.9.2026

I ended up moving even more of the boilerplate into the post metadata under posts.yml. Now including an image is simply a matter of calling the macro with the image name, and that's it.

Go back to list of entries