How to migrate wordpress blog posts to gatsby

November 30, 2018

Recently, mHotspot and blog were switched from two seperate wordpress installations to gatsby. The process, however, was easier than it should be. For mHotspot, I had to build additional templates for website pages and blog posts and make code changes to gatsby-config.js and gatsby-node.js. But the process for any wordpress blog (hosted at root directory) is pretty straight forward.

  1. Create a new gatsby site from gatsby starter blog.
  2. All the wordpress posts should be exported to markdown files using wordpress to jekyll plugin.
  3. Copy the downloaded .md files to ./pages directory. That's it! Your site should now display those posts.

This is not a full-length tutorial. You will need to make changes to the default gatsby-config.js, gatsby-node.js and graphql query for the post slug to appear the way you want. By default, post url will be the