Migrating from Jekyll to Ghost
Von Carsten
Yesterday I decided to make the move from Jekyll to the new blogging platform Ghost. I was interested in the project since the kickstarter campaign, but I didn’t join the founders then.
After releasing Ghost to the public I downloaded the published version and ran it on my local machine. Ghost is based on Nodejs, which I’m already familiar, so using npm and forever to run it was not much of a problem. After playing around with the admin interface for a bit I decided to research ways to migrate from Jekyll to Ghost.
Both blog platforms are using Markdown when you edit posts, so I figured it wouldn’t be too hard to convert the files. Unfortunately, Ghost is quite silent when it comes to documentation about their APIs or the import/export formats. I tried to come up with my own nodejs module to import files, but quickly discovered the great Jekyll plugin Jekyll-To-Ghost.
All you have to do is
- copy the plugin file into your _plugins folder
- make sure that your _config.yml includes safe: false (to enable plugins)
- run jekyll build
After your site is generated, you have a file _site/ghost-exported.json with all your posts in an acceptable JSON format which you can import into your installation of Ghost via http://yourdomain:2368/ghost/debug/.
I forked and modified the plugin a bit to convert links generated by the tag post_url into hard relative links (Ghost doesn’t support custom URL formats yet) and fixed the conversion of timestamps which was broken for me.
After importing all my posts I decided to run my own theme, so I copied the default theme casper and made some changes to it. Next would be to modify the theme and add Disqus for comments. I’m curious how the migration for the comments goes along, because I have to modify the identifiers in Disqus to use the new URL structure too.