Converting HTML to markdown for Hugo isn’t super-complicated, it’s just a bit annoying if you have to do it for a bunch of individual posts. There are a few options documented.
(Image to see if SVGs work here. I guess they do.)
I didn’t want to install new plugins on my aging WordPress installations, so I went for the Python setup ExitWP-for-Hugo. It takes the exported XML file from WordPress and churns out a bunch of .markdown files for the posts, which include the post metadata on top.
It doesn’t export comments (fine), it doesn’t convert images (fine). It’s a bit messy with some kinds of HTML, in particular if a bold section included a trailing space, then the markdown generated didn’t quite work. Also, for code sections, the code parts almost always didn’t get converted. All those funky Wordpress plugins sure make for convoluted content; I suspect it won’t be very different with markdown.
These things were easy to fix manually though.
For the older “Plog” setup database I had, I found an ancient plog-to-wp converter that imported the Plog content into a locally installed WordPress version. Importing the ancient .sql files into a local MySql database was a total hassle.
I ended up going with the simpler solution of importing RSS feeds. Luckily, the archived feeds had the full content, and the images were all hosted elsewhere. In order to install the WordPress RSS import on localhost, I had to add a setting to the wp-config (from here):
rss-importer.php script from WP needed tweaking to remove the magic-quotes function:
Changed line 72 from:
(just commenting the function call out so that it’s not used)
Importing the individual RSS feeds was flakey. Who knows why WP is so funky. Anyway. I ended up combining the RSS feeds that I had into a single XML file (in a text editor), and was able to import that after a few tries. Seriously, so flakey & annoying. I guess people don’t import RSS feeds into WP that often? Whatever. It worked in the end.
Once in WP, I just exported the XML file and used ExitWP-for-Hugo again.
Comments / questions
There's currently no commenting functionality here. If you'd like to comment, please use Twitter and @me there. Thanks!