Migrating From Wordpress To Hugo
Hello!
This site has existed in some form since 2012. Way back then, I started the site with a view to sharing PowerShell scripts I was using to manage some very large analysis services cubes. And because I just wanted to get up and running with content and not worry about the look or the site, I decided to go with a Wordpress site. And because I wanted a custom domain I promptly chose to have a premium Wordpress site.
I was very happy with the premium website, and even began customising the look of the thing once I got some content up and running. In fact, using the magic of the wayback machine I can show you how it looked back in May 2013.

However, I wanted to move from the Wordpress hosted to the self hosted Wordpress option. The main reason I wanted to move was because there were a few widgets in the self hosted option I could not use with my current setup. And so I decided to start a brand new blog with a view to migrating all my posts eventually to the new site.
Very soon after I had started, I realised that (to borrow a phrase) I had made a huge mistake. And the mistake I realised I had made was that these widgets really made no overall improvement to what I wanted to do, which was (and still is) write blog posts of things. And so I wanted to get off Wordpress and onto something simpler.
One of the things about a self hosted site is that there’s a cost up front, and the cheaper you want the deal per month the longer you have to commit to a company. And so I felt committed to sticking with my mistake. But then I remembered the idea of the sunken cost fallacy, so I bit the bullet and started up a Hugo site which is hosted in Gitlab pages so that I can use my custom domain. And all of this is free! I also moved my custom domain email to Zoho. So now my cost of running this site has gone from a couple of hundred a year to nothing. Cool!
The real pain point though was how was I going to migrate my content from Wordpress to markdown pages? I’ve got over 400 posts from two different Wordpress websites to move. I decided that the most pragmatic thing would be is to carry on writing new posts, and deal with the migration later. And finally, after starting this migration back in February, today I finally completed the move. And because someone somewhere may well be starting this painful journey, I thought I’d do what I’ve always wanted to do with this site and share some PowerSHell in the hope that it makes someones life easier.
The first thing I did it export my old site using the Wordpress admin console. This exports the entire contents of your website to a single xml file. It is frankly massive, with loads of content and meta data. Then I altered a few of the elements: I altered <dc:creator> to just <creator> and altered <content:encoded><