From Octopress to Pelican

If I want to blog about something the last thing I need is the blogging framework getting in the way.

I don't blog much, but every time I wanted to write something I had to basically relearn everything about my previous 'blog framework' to get that working.

I was spending way too much time on 'not writing', making me delaying any idea I wanted to put up. I considered moving to tumblr or something like it, but that was being too radical about it (also I like to feel at least some ownership on the process).

Recently I came across a blog post from Amy Hanlon about Migrating to GitHub Pages using Pelican. The process was very easy and motivated me to migrate from Octopress.

The migration was really easy and this is what I did:

  1. I followed the Pelican setup instructions (I left the fabric part out).
  2. I moved my Markdown files from the previous blog and changed the metadata for the Pelican fields.
  3. Added a new section I never published with the previous blog.
  4. I made a couple of modifications to the pelicanconf.py file.
  5. Publish to Github.

I had to spend some time on step #2 because I was basically editing out the metadata fields, but that is something that you can get done pretty easily once you master some keyboard shortcuts.

The new section I wanted to put up is based and constructed using IPython notebooks. A notebook can be exported as HTML and embedded into a blog. I added a couple of meta tags to the HTML head and Pelican accepted it, no questions asked.

At this point I was really happy with the outcome and was ready to push the new blog to Github, when I noticed something.

In the previous blog, the routes where:

http://sergiobuj.github.io/blog/YEAR/MONTH/DAY/POST-TITLE/

And now I had

http://localhost:8888/POST-TITLE/

In my case this is not very important because of the traffic, but there is a fundamental idea about those resources 'posts' that I would be breaking if I had let this happen.

Imagine someone bookmarked one of your blog posts that they really liked and want to come back and read it again. It won't matter how much you payed a designed for a beautiful 404 page, a 404 page is frustrating for an user.

It might not be my case, but I want consistency. And this turned out to be a very easy fix in Pelican. I added the following to the pelicanconf.py file:

ARTICLE_URL = '{category}/{date:%Y}/{date:%m}/{date:%d}/{slug}/'
ARTICLE_SAVE_AS = '{category}/{date:%Y}/{date:%m}/{date:%d}/{slug}/index.html'
SLUGIFY_SOURCE = 'title'

These options, and many more, are explained in the Pelican settings.

Last step was getting the generated files to the Github page. In the version of Pelican I used, a Github pages support is already available, but before make github can work I had to create the git project and add the remote.

social