Steps Moving from WordPress to Ghost

I recently moved this blog to the Ghost blogging platform. It was fairly easy, but did take a few steps, so I figured I’d document the steps I took to get there, in case anyone else was interested.

Deploying Ghost on Heroku:

I wanted the ability to customize Ghost code so I chose to host Ghost myself as opposed to going the Pro route, so I used cobyism's ghost-for-heroku instance on github. This takes a lot of the steps out of the process. This approach allows you to tweak the code for the theme, and even to install your own. It doesn’t however allow you to hack the base ghost blog source, as it treats ghost as a dependency. If you’d like to do more customization and tweaking to base Ghost functionality, I did find a couple of blog posts that might help...

Exporting My Wordpress Posts

Wordpress has an export to xml feature. Ghost imports in JSON format. To get your posts from one to another there are a few options. There are some wordpress plugins that will get you Ghost-compatible exports, but since I was using the free wordpress offering, I couldn’t add a plugin without installing a local version of wordpress. Instead, I found a wordpress xml to json converter called wp2ghost. Once converted I imported the JSON into my ghost instance, but still found that some of the formatting did not translate well. It left in some divs which were invalidating the markup, so I ended up manually going into ghost and deleting the rouge divs, replacing them with markdown where necessary. I could’ve does this with a script but since I was only dealing with a small number of posts I just brute-forced it.

Additionally my images were loading at the top of each post, where in my wordpress blog I was displaying them float right on the post. To get this effect back, I converted the markdown image format that it converted to and gave it an inline style to float it right.

Getting Syntax Highlighting for Code Examples

I’m starting using Ghost’s default Casper theme for my posts. Casper doesn’t provide a mechanism for syntax highlighting, but you can customize the theme to add it. Since I was self hosting my Ghost on heroku, I was able to customize my theme to use Google Prettify to highlight my posts. To add prettify, simply go to the main Ember template file for Casper and add markup to load the prettify javascript. Then in your markdown add the prettify class and the language to indicate what language to highlight.

Here’s the ghost blog post explaining the process:
https://ghost.org/forum/using-ghost/439-adding-syntax-highligting-to-code-blocks-in-posts/

Getting a domain

I decided to give the site a custom domain and not tie myself to a heroku.com address, since I’m moving from a wordpress.com address and I want to have a consistent address for future moves. I already had a 1and1.com account so I went with them for the domain registration. Then I used the pointDns heroku plugin to route the traffic to my heroku site.

Adding analytics

Wordpress gave me nice analytics of how many people were viewing which posts, and where those people were from. To get this same functionality with Ghost I set up a google analytics account for it. Its simple to add to your blog, just visit the google analytics site to get started. When you add a site it will give you a markup snippet to add to your site. You can put this snippet in the ghost admin console under /ghost/settings/code-injection, and paste your snippet into the “Blog Header” field. Click save and you’ve now got analytics.

Future Plans

  • I plan more theme customization as I go. I started with the very basic Casper theme and I’d like to add a bit to that… either by tweaking the casper code, or be finding another pre-packaged theme.
  • I plan to add the disqus plugin to the site as well in order to support comments. There’s a post on the disqus site for doing this.
  • I’d like to also add some of the more advanced cross posting capability that I had with wordpress, for example on the wordpress site whenever I posted a new blog entry it would share it on LinkedIn on save.
  • I’d also like to give back and maybe fix a bug or add a feature to Ghost.