It’s very straightforward to migrate your WordPress blog to a Ghost blog. First, we’ll start off by exporting everything out of WP, then we’ll set up Ghost, import everything, and finally tweak the setup so our old URLs are supported.
Get data out of WordPress
- Install the Disqus plugin and export your comments to Disqus.
- Install the Ghost plugin and obtain a .json file containing all of your post content and metadata.
Set up Ghost
- Provision a Ghost installation. Since Ghost is an early-stage project, it’s easiest to start from a pre-setup image, like the one offered by DigitalOcean.
- Log into Ghost by navigating to http://your-ip/ghost and creating an account. More info on this process here.
Move everything over
- Import your .json export from WordPress into Ghost by navigating to http://your-ip/ghost/debug and clicking import. Keep in mind, this will overwrite your login information with the root user used in WordPress.
- Add Ghost to your theme by adding
<div id="disqus_thread"></div>
to your theme’s post.hbs anywhere after ``. This will vary by theme.
Customize previous URLs
This is probably the trickiest part of the migration. Since Ghost is in very early development. We’ll need to add a redirection that follows our previous scheme. For me, I added the following code to line core/server.js in line 371 after the block containing the // ### Frontend routes
:
server.get(/^\/(2013\/?).*/,
function redirect(req, res) {
res.redirect(301, req.url.substr(5));
}
);
Your mileage may vary - mine was easier because all of my posts in WordPress were preceded by /2013/blog-permalink
.
Shoutout to these posts for help transferring my blog: