hayley 365


migrating from Ghost to Jekyll

13 Jan 2014

2014-01-13 23:53:00 -0600

Truth be told, I'm actually intended on moving to Middleman in the future (95% of my projects are built in middleman), but when I saw that jekyll had a ghost importer, I was sold. It wasn't a smooth process but we'll get to that soon enough.

why I'm moving away from Ghost

I can kind of be thankful to Ghost. It was the thing that gave me just enough of a push that I started a daily writing habit.

The huge reasons I'm moving away from Ghost are:

  1. it doesn't generate a static site
  2. I'm not using it

what I mean when I say I'm not using Ghost

I got burned several times early on when using Ghost. There were dumb things like when I clicked on a link in my own post and it loaded the link in the same damn window and just as feared, when I hit the back button, the post was gone. If I remember right, I had been writing for like 30 minutes to an hour when that happened. I was pissed.

I also had posts disappear for other reasons. Basically, Ghost does not autosave.

Ghost 0.4 just came out and it still doesn't have auto-save. Oh, apparently they added some notification to let you know when you're about to lose unsaved changes but that sure as hell won't help if there's a browser crash or some other circumstance that prevents you from actually seeing/acting-on this notification.

So, basically, after having been burned maybe 2 or 3 times (or maybe it took longer), I started writing all of my posts elsewhere. If I remember right, I started with Ulysses. Since then, I started a folder of text files on my Dropbox account where I've used various editors (both mac and ipad based) to edit them.

So my workflow basically became to write a post outside of Ghost, then copy/paste it into the new post window in Ghost, post it, then call it a day.

I would've moved to something different ages and ages ago, but to me, the writing itself took enough time that I didn't really feel motivated to spend any additional time doing work on the site itself. If I had known about the Jekyll importer though...

migrating from Ghost to Jekyll

It wasn't as seamless as it could've been.

missing dependencies

First, the instructions weren't 100%. Not a huge thing, but I had to install a couple of gems to get the importer to work:

gem install sequel
gem install sqlite3

the importer doesn't import images

So, I basically had to go through the posts by hand looking for places where I had uploaded a custom image. Then I went and downloaded it manually, then I fixed the link to it in the markdown file.

dates don't work quite right (have to use git master version)

Basically, I ran into a problem where Jekyll didn't appear to care that I had configured a timezone in the _config.yml file, nor did it care what timestamp had been put in the frontmatter.

For instance, I wrote a post on New Year's Eve, shortly before midnight. Despite everything (filename and the yaml frontmatter) saying that it was written on the 31st, it kept showing as being written in its UTC on the 1st.

The "fix" appears to be to remove the timezone info from the yaml front matter (like for instance, for EST in the states, you'd see -05:00).

Lucky me, I happened to find an appropriate github issue talking about this and asking the person if they could try the master version to see if it worked. It did for them, and it did for me.

fixing the date issue

Since Jekyll doesn't create a Gemfile for you, here's what you'll need in it:

source 'https://rubygems.org'
gem 'jekyll', :git => 'git://github.com/jekyll/jekyll.git'
gem 'rouge'

And as a side note, I've been writing this mainly in Editorial on the ipad in a dropbox folder. I wanted to pull the Gemfile out of Vim. I was able to edit the latest version in Vim with no problem, but Editorial didn't pick up the changes and instead created a conflicted copy. Frankly, I'm not sure how many editors would pick up on sync things like this anyway, but it sure would be nice for occasions like this one.

broken links

One other issue I encountered with some posts was that the markdown reference links were broken. I'm talking about the style where you do [text to link][nickname] and then down near the bottom of the file (or just elsewhere), you do [nickname]: http://www.google.com or something of the sort. Given that it was only some posts, I'm not sure whether it was a problem with Ghost or with the importer. But frankly, it was quick enough to fix that I didn't care to track down the cause.

If I were awesome, I would've automated this, but instead, I just did an ack search in Vim for the broken links and then fixed them by hand. Specifically, I used:

:Ack "\thttp"

This gave me a list of the files where it found the broken links, and then I just made sure to replace the tab character with an actual space and voilĂ , it worked like a charm.

my new workflow

It's a work in progress. As opposed to every other site where I use git to track changes and sync things around to different systems, I decided to try just moving it all to Dropbox for a couple of reason:

Like, do I really want to make a new commit every time I fix a typo? I'm lazy.

I'm happy though to have finally moved to something static. It felt really stupid to have to do two copies of everything I wrote (one copy as a text file, one copy in the Ghost database).

What's awesome about the timing too is that Ghost 0.4 just came out and there's nothing in it that's interesting to me. This matters because I tend to have a problem with switching back and forth between things. Like how I'll use Wordpress, then decide I'd rather do a full custom site, then decide I'd rather have the usability of Wordpress.

Though I do still think I'll be switching to Middleman for the blog at some point (especially for whenever I decide I want to add some custom content), I really doubt that I'll be returning to Ghost.

And probably not wordpress either.