Product E:ngineer

Going from Wordpress to Gatsby

January 06, 2019

w2g


State of Gatsby

This year’s Github report about projects revealed something. Gatsby is growing fast, as fast as it loads your webpages 🚀

More and more developers are building their portfolios and their blogs in Gatsby. I had my blog in a Wordpress site and I wanted to migrate to Gatsby.

The problem

The process wasn’t easy because I couldn’t find an easy and straightforward way to make it without any pain.

That’s why I took an action and created a simple NPM cli tool, the gatsby-wordpress-migrate in order to convert Wordpress XML exports directly to Gatsby compatible blog posts.

It’s treating our coding blogs with respect and converts all Coding blocks to the Markdown equivalents.

The problem I faced with another npm package was that it didn’t handle very well the strong tags, but also ignored the coding blocks if they were created by Crayon Syntax highlighter (the #1 in Wordpress).

Check my previous posts and see how the plugin converted the posts of mine!

How to use it

The process is straightforward.

Install the package

Use your favourite and install the package with the following command (yarn used).

# Install gatsby-wordpress-migrate with yarn and make it a dev dependency
yarn add -D gatsby-wordpress-migrate

Run the cli command

Right after installing it, write in the terminal the following command.

wordpress2gatsby <XML filename> <destination folder>
# Example: wordpress2gatsby wordpressdata.xml content/blog

Example of usage

Check a short gif on how to use it.

Example Gif

If you have any additional requests comment down to Disqus or open an issue on the Github repo of the project.


Thank you for reading this and I wish you a happy migration 🙌


Costa Alexoglou

Written by Costa Alexoglou Product Engineer at Loceye.io .
Drop an eye for updates also on Twitter