Site changes! Migrating from Hugo to Zola
Mon Jan 20, 2020

A lot of things have changed on this site, and all very suddenly. It looks completely different, some things are in different places, and (most importantly, although you can't see it) I've switched static-site generators!

Everything should be intact from the old site, with the exception of old microposts (they've been replaced by the Thoughts Page) and old comments (of which there were basically none). But why, you might ask? Well, hugo was starting to drive me nuts. The templating system is weird and I found that I was spending as much time trying to understand what it was doing as I was actually changing my site. For example, I was trying to change to a different theme, and suddenly all my posts from before 2019 disappeared. I asked for help on this issue in the hugo community and just got "works on my machine" responses. I was also getting a bit frustrated at the fact hugo doesn't help you at all in terms of actually organising content. So I switched to Zola.

You might ask, Why Zola? Well, I was looking around for another static site generator and it checked all my boxes. It helps more than hugo does with organising your site, has a more sensible template system, and I've overall found it nicer to work with. Let's hope it can last at least as long as hugo did before I find some reason to want to replace it again.

I'd be lying is I said I'd redesigned this site, the current theme is a Zola theme called Sam which I'm going to be modifying over time, so expect some changes to the look of the site as time goes on.

The Migration Process

Migrating from Hugo to Zola wasn't ridiculously simple, but it was fairly simple. Both use markdown for posts, although they use different front matter. Migrating my posts and content was as simple as converting the front-matter, which I did using this python script:

import yaml
import toml
import os
import datetime

for f in os.listdir("posts"):
    s = open("posts/"+f, "r").read().split("---")
    y = yaml.full_load(s[1])
    nf = {}
    if "tags" in y:
        nf["taxonomies"] = {"tags": y["tags"]}
        del y["tags"]
    if "draft" in y:
        del y["draft"]
    if "type" in y:
        del y["type"]
    for k in y:
        nf[k] = y[k]

    s = "+++\n" + toml.dumps(nf) + "+++" + ''.join(s[2:])
    with open("posts-toml/"+f, "w+") as o:

Then I just moved files around and did some small markdown edits to the posts to fit Zola's directory structure, and I was pretty much done! I had to modify the theme to support using isso for comments, but I also had to do that with hugo.

So...yeah. New start for this site, expect a lot of changes coming soon.

photos · music · code · posts · notes · about · home