Hello Ghost!

I have been meaning to get this site back on track for sometime now. It has been a while. Procrastination was one primary obstacle, Wordpress was another. But then I discovered Ghost thanks to two of my colleagues12. Inspired by them, I migrated the entire blog to Ghost complete with a new shiny handcrafted theme.

Migration wasn't that hard and all the heavy lifting can be done by an easy to use WP plugin. But it wasn't smooth sailing all the way through though; there were some wrinkles to iron out.

Replicating the permalink structure

The permalink structure that I have used over the years has a /archives prefix to the post slug like http://rusty.in/archives/hello-ghost. This was surprisingly not a configurable option in Ghost via the admin interface. I had to pull my hair trying to figure this one out since I didn't want my old links to end up dead. I considered doing 301 redirects but that was too much of a mess. As a last resort I thought I'll fork the project and build it custom. Going through the code I realised that Ghost already had this in the code; just that there was no UI exposed to configure it. So all I had to do was to update a value in the sqlite db and viola problem solved. The update query is below:

update settings set value = "/archives/:slug/" where key = "permalinks";

This shouldn't have been this hard to figure out!

Migrating Disqus

I was already using Disqus with Wordpress so I thought this wasn't going to be hard. But it was. None of old comments were showing up despite the correct embed code I had used. After a bit of digging around I found that Ghost always appends a trailing / to the permalinks of a post, my old installation didn't have that / and Disqus couldn't map the page properly to the comments. There was no helper method available in the Ghost templating system that could remove the slash.

Now the politically correct way to fix this would have been to upload a mapping file to Disqus and re-map all the urls. But laziness trumps correctness, so instead of doing that a simple dirty JS hack did the trick - just trim the last char in JS.

....
var disqus_config = function () {
    this.page.url = "{{url absolute="true"}}".slice(0,-1);
};
....

HTML & Design

It's been a very long time since I did any sort of serious HTML stuff. Now this was a fun challenge. The site design in based on Yahoo's Pure CSS framework and conveniently they had a ready-to-cook blog layout template which was easy to hack. It also handled responsiveness to an extent, but making it work properly and look decent on all most devices stretched the limits of my CSS skills. But happy to have dived into this and not use a readymade theme. I learned a new trick or two and it turned out not that bad.

Nostalgia

Before I first moved on to Wordpress back in 2005, the blog was running on a static site generator3 called Cyberian Blog. I had meant to migrate those old posts to the new WP installation but never got around to doing that (for 11 years!). I was determined to do this now, and unfortunately I had lost those backups. But this wonderful thing - Internet Archive's Way Back Machine - had me covered. I did lose a few of those posts; but got most of it back on the blog. It was an awesome nostalgia trip reading those notes again despite the sometimes embarrassing posts by 18 year old me. They are all here now, dating back to February 1, 2001

So that's that. Cheers to another new beginning and broken resolutions to write more!

  1. Vishnu

  2. Sunil

  3. The irony! To think that I moved from a static generator to the burly bulky Wordpress. Times were simpler.

Previous post
Flickering text with CSS and JavaScript
Next post
Malayalam slang and their origins