Moving To Hugo
After many years using an ancient GPL version of MovableType (4.32, the last to support PostgreSQL. I have aversion to MySQL) I’ve gone to a new static site generator - Hugo. I’ve previously looked at Jekyll but the complexity of migrating my MovableType content over was just too much. Finally I got sick of paying for a server that gets no use and moved my blog to S3 storage and had to do something.
Hugo seemed like the best choice. I’m not likely to add features so the language makes no difference, but it was simple and customisable. The main selling point for me is the ease of theme installation. I eventually settled on Tranquil Peak with one of my photos as a background image.
The first thing I set was
uglyurls = true in
config.toml so Hugo would generate
slug.html instead of
slug/index.html, I don’t see the need for a directory per
post, and this matched my old MoveableType setup.
To convert over my old posts I hacked together some Python using BeautifulSoup to scrape out the content, and then integrated html2text.py to covert the content back to the original markdown. I did use markdown in MovableType (with SmartyPants - the original Perl!) but importing it in to Postgres to extract the content seemed harder for some reason. The script also extracted the publishing dates and titles. I didn’t extract the slug as it almost always matched the title, but I regretted that later when I found hugo and MT had different slug generators. If you’re interested the conversion script is here
I then dumped all the images in to the static directory and ran
diff -qr -x .DS_Store public/ ../sitharus.com/ | grep Only to see what’s missing. I found
a few mismatched slugs and images uploaded to the wrong place.
All in all pretty painless!