A New Place To Call Home

Better late than never, right?

Its taken a while, but I've finally converted my WordPress to blog to Ghost. Ghost is an open source blogging platform, with a heavy focus on the content being created. Minimalistic (to my eyes, anyway), and lightning fast.

As I'm lucky enough to have an MSDN subscription, I've hosted my website on Azure, where I get free credits each month, which can be used towards any of the bajillions (yes, a Realâ„¢ unit of measurement) features available.

If you want to host a website on Azure, you can too! If you sign up for the Azure Trial, you get 10 websites for free, which run an amazing range of platforms/techs. Check it out here!.

One of the most amazing features that Ghost supports, is the use of Markdown within its posts. Think of Markdown as like a short-hand formatting mini-language. Putting in a new heading is as easy as typing "#My Heading". In short, its amazing.

On Azure, you can also spin up a pre-made Ghost Website, without any of the messy fun stuff I had to do to get it working.

I'm not going to bother going into the steps I took to get it up and running, as others have already covered it many times, all in excellent details Scott Hanselman's site is where I found the most helpful content around the Azure-related commands, for use when wanting to create websites on the fly, on Azure itself (it's awesomely simple!). And for the actual meat & bones of the site itself (generating the correct JavaScript/Styles/Dependencies etc), I used a post on one Jeremiah Billmann's website. I found Jeremiah's post to be a bit more helpful, as I was running into issues with Scott's around the Grunt initialization (though in retrospect, it was most likely a PEBKAC issue). One very important lesson learned, is that all of the grunt/npm commands should be run in the same folder as where your Ghost site is located. If not, things will not install correctly (or at all!) and you will be scratching your head wondering where it all went wrong.

The other awesome thing with the above two links is that both deal with deploying to Azure from a Git repository. Make some changes, commit, and push to the Azure Git remote (think of it as a staged location) that Scott's post will add for you (or you can add yourself, using the guide in Jeremiah's post), and Azure will automatically pick it up, check it and deploy it.

It's bloody Magicâ„¢.

I've also used a nifty little tool, called "wp2ghost", to convert my posts from WordPress' XML format, to the JSON format that Ghost is expecting.

To export the posts from WordPress, go to the WordPress Dashboard, go Tools -> Export, and then click "Export", which will start a file download containing the content of your blog (images included!).

Note: If you are currently self-hosting your WordPress blog, you can do this much quicker with the Ghost Plugin for WordPress. Install the plugin, and click 'Export', and that's it. The steps below are not required.

Go to the wp2ghost page, and download the zip file. Extract it somewhere.

A Gotcha: There is an issue with the package.json file in wp2ghost, where the version number in the package.json file (what the NodeJS Package Manager uses to resolve dependencies for the package), is invalid, as NPM uses a semantic versioning scheme, expecing 3 lots of numbers.

Open the package.json file, and change the version value from "0.0.3.4" to "0.3.4" and save it. Then run...

npm install  

...from the NodeJS Command Prompt, in the location you've extracted the wp2ghost utility, it will magically (not magically, but you know what I mean) resolve the dependencies it needs.

After this, copy your exported WordPress XML file to the wp2ghost installation directory and, using the NodeJS Command Prompt, run:

node wp2ghost [yourfile].xml  

As my very first contrubution to the open source community, I've fixed the package.json file and sent a Pull Request to the project's creator. Exciting!

Now that's all taken care of, to import the file into your Ghost website, it's a simple matter of going to:

http://[yourghostblog.com]/ghost/debug  

And from the file picker displayed there, import the file and its all done (images included, which still boggles my puny mind!).

So there you have it! My journey from WordPress to Ghost has been fun, and I hope this helps anyone looking to make the same move.

Good luck! Ping me on Twitter if you have any questions or comments :)

Other useful links...