Aeons ago I started to blog with Movable Type, and then switched to Wordpress in 2006. Technically, a blog could also be generated by a static site generator and be much less work.
So, here's how I converted this thing to a bunch of folders full of Markdown files.
- Export an XML file from the WordPress admin interface.
- Clone the exitwp repository by issuing
git clone https://github.com/thomasf/exitwp.git ~/Dev/exitwpin your terminal. This converts the WordPress export to a bunch of Markdown files and also grabs (most of) the images. - Copy the exported XML file to the path where
exitwpwould like to have it:cp ~/Downloads/*.xml ~/Dev/exitwp/wordpress-xml - Run
exitwp:cd ~/Dev/exitwp/ && python2.7 exitwp.py(If you setdownload_images: Trueinconfig.yamlyou should also get (most of) the images). - You now get an export of the site in
~/Dev/exitwp/build/jekyll/habi.gna.ch.
- Start a new hugo site with
cd ~/Dev && hugo new site blog --force. This only has to be done the first time... cd bloggit submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/anankeecho 'theme = "ananke"' >> config.toml- Edit
config.tomlto taste. - Now unzip the
hugo-export.zipfile from above. - Copy all the posts from the exported directory to the
blogdirectory:mkdir -p ~/Dev/blog/content/posts && cp ~/Dev/exitwp/build/jekyll/habi.gna.ch/_posts/* ~/Dev/blog/content/posts/ - Copy all the images from the
exitwpdirectory to theblogdirectory:mkdir -p ~/Dev/blog/static/images && cp ~/Dev/exitwp/build/jekyll/habi.gna.ch/images/*/*.* ~/Dev/blog/static/images/. We move the images from their subfolder to a single new folder. - Now you should have a (semi)working hugo blog, test it with
cd ~/Dev/blog && hugo server. All images are still served from their original URLs.
- Follow this guide
- Set up DNS, e.g. point
blog.davidhaberthuer.chto GitHubs nameservers. - Fiddle with the settings in the Github repository until DNS has propagated and the CNAME file here can be generated.
- See that the blog is available on https://blog.davidhaberthuer.ch/