jakub holý

building the right thing, building it right, fast

Migrating from Wordpress.com to a static site generated by GatsbyJS

2018-12-13General

I am moving my blog over from Wordpress.com to a statically generated site using Gatsby. Wordpress has served me well in many years but it isn’t really fit for writing (about) code and the latest updates have made it even more difficult for me. With Gatsby I get a quick site and full control over everything (using JavaScript, React, and any of the tons of plugins for Gatsby).

The content from my old blog is coming soon, it is work in progress :-)

If you are interested in the details of the migration, check out the blog code at GitHub, especially blog2md-master/index.js and gatsby-node.js. The core of the process is using blog2md to turn Wordpress export XML into .json files and then loading those into Gatsby and suing custom code in gatsby-node.js to create an “adapter” node type ContentPage for both new Markdown-based posts and the old ones from the .json. In practice it is somewhat more complicated that it sounds - just as always.