I used to post blogs at
/blog/. A couple weeks ago, shit hit the fan, and I lost the sources to my website. It was a statically generated site using a simple generator I wrote in a couple hundred lines of Ruby. A publishing script would copy over generated content to a repo that pushed to the Gitlab remote repo, check the changes in, and push. It’d delete the contents of that other repo in the process. It’d also copy stuff over to
~/pub, a directory which I used to serve on my system with Nginx for some scripts, but had removed a while ago for some reason. Because I hadn’t enabled the obscure but useful flags which could catch errors like these, a failed
cd resulted in the deletion of content in
$PWD, which happened to be the directory that contained the website sources. And pooff, both the files and the git repo deleted, gone for good.
I had recently moved from a highly customised Debian-based setup where I have been using a script to do my backups, to one based on Linux Mint and Cinnamon. The script required dropping to vconsole and remounting a filesystem readonly in order to produce a complete tarball of my files. I’d do this weekly and store a few of the resulting tarballs, deleting the oldest one each time. With the new system I thought I needed something that could work on-line, without the remount, and without weekly full backups, so I removed the script and… procrastinated on setting up backups. Lucky I was that I didn’t lose research related stuff or other documents that’ve been generated since.
I’d have to recover content from the last 8 months manually in order to be able to revive my setup. That’d mean to recreate the Textile sources manually from the HTML files (maybe pandoc could’ve helped there?) and to recreate the scripts and configs that processed the files and uploaded the resuts. The process would inevitably result in mistakes and incompatibilites, so I though I’d rather build a new website from scratch. It’d also be a nice opportunity to improve on what I had.
So I decided to redo a blog and to keep the HTML sources of my old blog as static files in the new blog so I wouldn’t break links. After shopping around a bit on StaticGen I decided I’d give good old Hakyll another go.
It took shape after a few days of work, and I managed to put together a fairly nice thing where I got some theming and template reusability so that I could add new blogs with similar layout but own colourscheme later. Thanks to Sass—without which this would be too much trouble—I got to support
prefers-colour-scheme too, so if you have dark mode enabled on your desktops, I got you coveredFWIW.
As I write this blog post I’m cutting the last of corners and getting ready to publish. I’ve manually added a notice on the old blog’s RSS feed, and a big banner on the old blog’s pages telling the news (w/o modifying the HTML files thanks to
:content CSS pseudoclass).
So, this is what came out of it, a website which I think looks and functions better. Enjoy!