In a previous blog post, I wrote that you shouldn’t run a database if you don’t have to.

Well, I wasn’t exactly following my own advice by hosting this blog on a cloud instance running Wordpress. The time has come to migrate to using a static page generator – something I’ve wanted to do for a while but put off because I dread frontend stuff.

I’d experimented here and there with Jekyll and Hugo and GitHub Pages and all that, but I was wholly unsatisified with the migration tools I found. They all left me with some yucky half-markdown-half-HTML mess that required a bunch of manual regexing. There’s not a whole lot on here, but it got pretty tiring after a few hundred lines.

And then I found wordpress-export-to-markdown, which did an absolutely fantastic job. So, shoutout to lonekorean on GitHub for that gem.

I more or less followed the Hugo getting started guide using the Git submodule layout. After finding a theme, doing some tweaking, and organizing the content, things were more or less ready to publish.

Finally, a script to publish new changes:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#!/usr/bin/env bash
set -eux

PUBLIC_DIR=public

hugo -d ${PUBLIC_DIR} --ignoreCache

pushd ${PUBLIC_DIR}
git add .
git commit -am 'publish' || true
popd
git add ${PUBLIC_DIR}
git commit -am "${1:-auto publish}" || true
git push --recurse-submodules=on-demand

Bye, Wordpress.