The Odd Angry Shot

Virtualisation from the trenches

Jan 6, 2019 - 2 minute read

Migrate to Hugo

With plenty of unfinished drafts growing, I thought I’d procrastinate even more by jumping on the static website bandwagon.

I’ve migrated from Blogger to Hugo, and hosted on AWS with CloudFront.

The process to migrate from Blogger to Hugo has been incredibly time consuming. Honestly I have no valid reason to change except for the fact that I’m curious to find out why many others seem to be migrating to static websites in droves.

For the way I usually work, I think I’ll be worse off, losing the flexibility of easy formatting and adding images, but hey, the load times will be faster right?

There’s several ways to migrate. Because most of the tools are for WordPress, initially I exported from Blogger to free hosted Wordpress (I always had it there as a backup/migrate to WP one day), and then exported from WordPress and used exitwp locally. That didn’t bring in the comments, so I thought I’d try WordPress to Hugo Exporter Plugin, but it only works on self hosted WordPress.

Going further down the rabbit hole, I spun up a local WordPress instance on my NAS, then imported the Blogger xml, installed the WordPress to Hugo Exporter plugin, and exported the content.

I used sed to remove or edit some front matter lines, eg:

Remove multiline tags no longer required:

sed -i '/^blogger_author:/,+1d' *.md

Replace hardcoded absolute paths for images with relative paths:

sed -i 's/\"http:\/\/\/wordpress\/wp-content\/uploads\//\"\/img\//g' *.md

Reused the blogger_permalink for aliases:

sed -i 's/^blogger_permalink:/aliases:/' *.md

Most of the posts looked OK in Hugo, but there was still a day or two on checking all the posts, and fixing up some wayward <div></div> tags.

Let me know if there’s any issues.