I've recently migrated away from Github Pages as my blogging solution. One of the reasons I feel that I'm not writing a lot is because publishing via Jekyll + GH Pages is a very manual and cumbersome task. Especially when media/images are involved.

I'm already in the coding environment for a huge chunk of my day, I don't want to be in there even when blogging. So I decided to switch to Ghost for my blogging needs.

Steps to Migrate Posts from Github Pages / Jekyll to Ghost Installation

  • Clone your Jekyll Github Pages repo
  • Go here and download jekylltoghost.rb file and put it into your Jekyll site's _plugins directory.
  • Open the above file and change the version field to your Ghost Version (you can find it from the Admin section of Ghost Installation -> "About Ghost")
  • Run:
docker run --rm \
  --volume="$PWD:/srv/jekyll" \
  -it jekyll/jekyll:$JEKYLL_VERSION \
  jekyll build
  • You will get a ghost-export.json file in your _site directory

This file outputs the json format for the Ghost 0.X / 1.X verisons. For Ghost Version 2.0 we need to do a little bit of custom plumbing for migration as described here:

Requires Node.js v10 installed locally

  1. npm install @tryghost/migrate -g - install the migration tooling
  2. migrate json html /path/to/your/import.json - will convert the HTML fields in your JSON file
  3. The tool will output a path to a converted JSON file - use this to import your content
  4. Run npm uninstall @tryghost/migrate -g to cleanup

The above command will output a file called ghost-import-.....json file in your current directory. Take this and upload to Ghost Admin -> Labs -> Import Content.

Voila! Enjoy :)

PS: I still haven't figured out how to convert images, maybe I'll post once I do.