How to migrate from Wordpress to Ghost 2? (June 6, 2019)
During my (trial) move to Ghost v2 I had to migrate all of my posts written in Wordpress. I could easily export them from WP but importing them into Ghost was the difficult part. This is because there is no official plugin to do the export. There is one, but it only supports Ghost 1.
So what is the solution?
You have to install Ghost 1, do the import and upgrade. But not everyone can do that on a hosted Ghost or their VPS. I was looking for a workable solution until I found this. Assuming a little bit knowledge of Docker, it gives you a simple way of doing the export. Basically, you have to use Ghost exporter plugin for WP to export your posts to Ghost 1 format, set up a Ghost 1 docker, import that file, destroy the Ghost 1 docker (but keep its contents), set up a Ghost 2 docker based on same contents source (at which point you will have all your posts in Ghost 2). Then you export from Ghost 2 docker and import in your VPS/Hosted ghost.
Below are steps in more detail:
Install Ghost export for WP plugin. In your WP console, use the plugin to export your posts. You will receive the export in a json file named ghost.json Create a directory on your computer to store Ghost’s contents (e.g. /path/to/ghost/blog). Run below command to start a Docker based on Ghost v1 docker image:
docker run -d \ --name some-ghost \ -p 3001:2368 \ -v /path/to/ghost/blog:/var/lib/ghost/content \ ghost:1-alpine
At this point, browse http://localhost:3001/ to see your newly set up Ghost.
Register on your local Ghost and import content from ghost.json you received on step 2.
Remove your Ghost docker by docker rm -f some-ghost
Start a new Ghost docker by running below command:
docker run -d \ --name some-ghost \ -p 3001:2368 \ -v /path/to/ghost/blog:/var/lib/ghost/content \ ghost:2-alpine
Again, go to http://localhost:3001/ to have a fresh Ghost 2 installation.
Register and log in. You will have all your posts in Ghost 2 format.
Export from Ghost to a new ghost.json but this time in Ghost 2 format.
Import ghost.json from step 11 into your hosted Ghost.