Migrating from Octopress to Ghost

As I described in my last post, I just migrated from Octopress to Ghost. The migration was actually pretty simple and I didn't have any serious issues during the process. I was surprised to find that there weren't really any good guides out there on the topic, though. So, here is a quick brief on how to go about doing this, if you are looking to move to Ghost from Jekyll + Octopress.

Step 1: Sign-up for Ghost (or install it)

I'm using a paid-for Ghost instance. If you are doing the same thing, head to the Ghost website and create an account. Then create your new blog.

If you are hosting your own instance of Git, follow the instructions provided by Ghost for getting the code and installing it.

Step 2: Export Your Posts

Next, you'll want to export all of your posts from Jekyll + Octopress to a JSON file so that you can import them to Ghost. There are a couple of options out there. I used this one from mattvh. The exported file wasn't in the location that the docs said, but you can find it pretty easily. After following the instructions on that Github page to clone and install the script, and then running the build, you can find the output with this:

$ find . | grep ghost_export

Put that file someewhere easy to find.

Step 3: Import Your Posts

Your hosted blog should be at yourname.ghost.io. If you head to yourname.ghost.io/ghost/debug you will find a Ghost admin interface. Use this to import that JSON file that you just exported.

Step 4: Fix Your Posts

At this point, you will want to go through your posts and fix them. You will need to import images manually. For everything else, like Youtube links and such, you may actually find it easier to export your posts (using that interface above), and write a script to re-write any Octopress-specific links to the Ghost format, and then re-import them.

One thing I will note here is that Octopress really likes newlines, and Ghost hates them. If you have \n characters in your posts, I recommend stripping them.

Step 5: Migrate DNS

Now you will need to change your DNS settings. The Ghost documenation on this is actually pretty good. You can find the Ghost docs here. I use Namecheap (left GoDaddy for them during that whole SOPA / PIPA mess), and Namecheap does indeed support the 'alternative CNAME' functionality that Ghost wants.

Step 6: Migrate your Disqus Discussions

I was pretty worried about this one, because I really wanted to keep the discussions in my old blog. Thankfully, the Disqus folks have made it pretty easy to completely migrate blogs.

Now that you have migrated to your new domain name, your blog should be serving up pages at yourdomain.com/this-is-a-post/. So, now we need to tell Disqus to move all discussions from your old Octopress URLs to these URLs. Head to your admin page in Disqus. Select the blog you need to migrate, click Discussions, then Tools, and you should see a link for a Migration Wizard. This is what you need. Start the wizard, and it will generate a text file of all of the URLs it has for your blog. Now, turn that text file into a CSV file, matching each old URL to a new one, like so:

your-old-domain.com/this-is-a-post/, your-new-domain.com/this-is-a-post/

Do that for each URL you want to migrate, and then upload that CSV file back to Disqus. Before too long, you should get an e-mail that the migration has completed.

Step 7: Theme Customization

You will need to modify the Ghost theme that you selected to use your Disqus shortname information. Most themes seem to have this code already built-in, but if yours does not, you can follow these instructions to add it.

My theme had the Disqus conversation support, but not the comment count code. When I added that, I noticed that it would sometimes take a little while for comment counts to show up, so don't worry if you see Comments instead of 0 Comments next to some posts for a little while after setting this up.


That's it! You should now be all set. Have fun =)

Ben Hilburn

Ben Hilburn

bits, nibbles, bytes, and words
D.C. Metro Area