From Jekyll to Ghost

Last week, I migrated this blog from using Jekyll to generate a static site, to the hosted Ghost(Pro). There were a few reasons I wanted to do this -

  • I wanted a CMS
  • Managing all the posts' raw markdown files in one folder was getting clunky
  • The Jekyll build process was starting to significantly lag
  • I no longer wanted to have to manually upload new posts via FTP
  • I wanted to be able to schedule posts (although Ghost doesn’t support this yet), or at least push one button to publish them

Although Wordpress is the typical candidate for things like this, I don’t particularly enjoy using the Wordpress backend, especially their content editor. I like to write my posts in Markdown and I wanted something very stripped back.

So, last week, I did the migration. Here is how the process went, and how I’ve found using Ghost for the past week.

The Migration Process

Step 1 - Creating a Ghost Theme

The first thing I had to do was create a new theme that would be compatible with Ghost. Although Jekyll and Ghost are both based on the Handlebars templating language, there are significant syntax differences I had to take into account.

For example, in Jekyll, to loop through all the posts for the homepage, I would write -

{% for post in paginator.posts %}
  // post excerpt here
{% endfor %}

Whereas in Ghost, I would write -

{{#foreach posts}}
  // post excerpt here

I had created a theme for Ghost before (It’s called OpenWriter and available for free), so this stage wasn’t a major hassle.

Step 2 - Exporting the Posts

As far as I know, there is no way to export/import the posts between the two formats. So, I had to manually copy and paste each post from its raw markdown file in the Jekyll site to the Ghost markdown content editor.

This was a tedious process.

Additionally, because of the differences in markdown between the Jekyll and Ghost, I also had to edit most of the posts. For example, the way code snippets are highlighted between the two requires different syntax.

In Jekyll, to add an html code snippet, I would write -

{% highlight html %}
   <div class="foo"></div>
{% endhighlight %}

Whereas in Ghost, I would write -

  <div class="foo"></div>

Luckily, I only had 37 posts, so it didn’t take a horrendous amount of time, and I tried to make use of search and replace where possible.

As a side note, Ghost doesn't have in-built syntax highlighting, so I used [Prism.js]( in my theme.

### Step 3 - Transferring the Domain

The next thing I had to do was transfer my domain to Ghost’s servers. This was a bit of a hurdle. 

The only way to use Ghost with a root domain is use an @ CNAME record, which most DNS provider’s don’t allow you to do. Because of this, I had to transfer the DNS management for to [Cloudflare]( 

Ghost provides some good [documentation]( on how to do this so it wasn’t particularly difficult. However, I did run into some issues following the steps and accidentally created an infinite redirect loop causing the site to be down for a while. I emailed the support team and they were really good in helping me fix the problem. 

### Step 4 - Handling 301 Redirects

The final thing take care of was the change in URL structure. With Jekyll, the url structure I set for my posts was -[year]/[post-title]

However, with Ghost, I was unable to have this same structure. So I instead opted for the simpler -[post-title]

Because I was using Ghost Pro, I did not have access to a `.htaccess` file to add the 301 redirect myself. I had to email the support team to help me do this. This went quickly and smoothly.

Because of the change in URL structure, there was also the potential for many broken links. I discovered [Integrity](, a Mac app that crawls your site and looks for broken links. This was very helpful in allowing me to identify all the places within my posts I had linked to another post so I could change the link to the correct one.

## Ghost vs Jekyll 

Now that everything is done and I have been using Ghost for the past week, here are my thoughts on the platform.

### The Cons

To begin with, there were a few things I already knew I was giving up -

1. **Flexibility**. With Jekyll, I was able to do *anything* I wanted. I was really limited only by my technical abilities. With Ghost, I can only have features that are supported by the platform.
1. **Stability**. Ghost is still in beta. They could decide to scrap the platform tomorrow and, because I am on the hosted version, that would mean I would need to change to another platform.

That being said, here are a couple other drawbacks for me -

1. **No post scheduling (yet)**. Although this is up next on their [roadmap](
1. **No support for tables in their flavour of Markdown**. A relatively minor con, but it is quite annoying. Whenever I want to include a table in my post, I have to write an HTML table. And I like adding tables. For now, I still write my tables in Markdown and use an [online markdown converter](

### The Pros

1. **Publishing is hassle-free**. I will never mistakenly upload the wrong files via FTP again.
1. **It’s completely open source**. Because Ghost is open source, I could download a copy of the source code and run my own version on my own servers. So, if they did decide to stop developing it, I could still use whatever version I currently had forever.
1. **Great community and support**. The Ghost community is really helpful. They have an open [Slack team]( where you can quickly get answers to questions.
1. **Great content editor**. I *really* enjoy using it.
1. **Great, simple CMS**. 

![Screenshot of Ghost Backend](/content/images/2015/11/Screen-Shot-2015-11-14-at-18-28-45.png)


At this stage, for me, the pros outweigh the cons. I don't think Jekyll was the most scalable solution for a blog. I'm glad to be moving to a CMS and will see how Ghost works out in the long run.

If you have a blog, I'd love to know what you use! Leave a comment below.

blog comments powered by Disqus