Migrate Wordpress to Hugo

Migration of old sites and articles to Hugo

Jekyll Exporter (github page) is a plugin that will export everything from WordPress to Jekyll.

There is also WordPress to Hugo Exporter but I choose the one for jekyll because the plugin is already available in the WordPress plugins.

A good amount of work is still needed to fix the results so I didn’t bother.

Change wordpress site URL

The old site url is not available. I created a new CNAME in the DNS.

To change the settings int the wordpress database run the following commands:

UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');

Jekyll Exporter

From the WordPress administration go to Plugins -> Add new, search Jekyll Exporter by Ben Balter and install it.

Activate it in Plugins -> Installed plugins.

In Tools-> Export to Jekyll the plugin will create and download a zip file with all your content.

Extract the zip and start to fix all the things: reorganize images and convert all the unrecognized plugins code. Have fun!