Export and migrate WordPress to Ghost

A little while ago I installed Ghost on IIS, along with the required Node.js and iisnode module. All in an isolated test environment, in which Ghost runs as a production site only. Now I wanted migrate from WordPress to Ghost, but failed. Here’s the write up.

Export WordPress content into a JSON format #

Migrate from WordPress to Ghost and import posts from wordPress into Ghost, how to.

There are two ways to export your WordPress blog content into Ghosts JSON format:

  1. the Export to Ghost plugin
  2. wp2ghost, which will convert WordPress XML exports (WXR) to the Ghost JSON format

I tried both and both produced a JSON file, so that’s good.

Pro tip: format your WordPress JSON export file #

The produced JSON export file is one long string, which makes it really difficult to read (and fix errors). I decided to format my JSON file for readability. With python json.tool:

$ cat wp2ghost_export_1402927865.json | python -mjson.tool > wp2ghost.json

Now you can actually read the contents of your JSON file and fix errors later on when they occur (they will…).

JSONLint – The JSON Validator #

JSONLint.com is an online tool to validate your JSON file. JSONLint is a validator and reformatter for JSON, a lightweight data-interchange format.

I thought you might find this interesting:   How to block BaiduSpider bot User-Agent

It’s a great aid for when you run into error messages such as:

{"error":"Failed to parse the import JSON file"}

Import WordPress content into Ghost #

To import your WordPress content into Ghost, you need to visit your the Ghost debug tools page at http://www.example.com/ghost/debug. Select the file and press IMPORT.

If all goes well, your WordPress content is imported into Ghost. It didn’t go well on my site… A little pop-up provided only the error message:

A problem was encountered while importing new content to your blog. Error: unknown

and unfortunately iisnode didn’t log more information within its log directory. I tried again, and I first enabled my Chrome Developer Tool (function key F12). The Network tab displayed all requests and showed an HTTP 500 Internal Server Error on the import, but nothing more.

Since I host on IIS, I enabled IIS Detailed Errors and tried again. Now the response contained a real error message:

{"error":"Value in [posts.title] exceeds maximum length of 150 characters.<br>Value in [tags.description] exceeds maximum length of 200 characters."}

Praising myself for making my JSON file more readable, I grepped the title: grep \"title\" wp2ghost.json and found one title longer than 150 characters. I couldn’t find a long tags description though, so I tried again.

This resulted in an error again:

{"error":"Value in [tags.slug] exceeds maximum length of 150 characters."}

After fixing this error too (e.g, shorten the slug), I could successfully import my WordPress content into Ghost. So I guess there was no problem with the tags.description.


Please Support Saotn.org

Each post on Sysadmins of the North takes a significant amount of time to research, write, and edit. Therefore, your donation helps a lot! For example, a donation of $3 U.S. buys me a cup of coffee, and as you know: things jsut work better with coffee. A $10 U.S. donation buys me one month of web hosting (yes, hosting costs money). But seriously, thank you for any amount. Much appreciated!

I thought you might find this interesting:   Important note about Windows Update KB4056892

Please donate to support this site if you found a post interesting or if it helped you solve a problem. Thanks! (Tip: no Paypal account required)

If you appreciated this post, then please donate using this Paypal button


Jan Reilink

My name is Jan. I am not a hacker, coder, developer, programmer or guru. I am merely a system administrator, doing my daily thing at Vevida in the Netherlands. With over 15 years of experience, my specialties include Windows Server, IIS, Linux (CentOS, Debian), security, PHP, websites & optimization.

Leave a Reply

Be the First to Comment!

Hi! Join the discussion, leave a reply!