Fork me on GitHub

Switching to Pelican

The last two years have been spent ignoring this site so obviously it is time to redo it. A coworker told me about Pelican a while back and it seemed like it would fit my needs so I gave it a try. I turned out to be really easy and I managed to convert the site to use Pelican and publish to Heroku in about two hours.

First I installed Pelican into a virtualenv and ran the quickstart:

pip install pelican
pelican-quickstart

The quickstart just asks a few simple questions about the site. When it was done I poked around in pelicanconf.py to see what knobs could be fiddled with. I fixed up the timezone, removed SITES and filled in the SOCIAL links. This is what it looks like today:

#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals

AUTHOR = u'Tom Manley'
SITENAME = u'Tom Manley'
SITEURL = 'thomasmanley.org'

PATH = 'content'

TIMEZONE = 'America/Chicago'

DEFAULT_LANG = u'en'

DEFAULT_CATEGORY = 'Dev'

ARTICLE_URL = 'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/'
ARTICLE_SAVE_AS = 'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/index.html'

# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None

# Social widget
GITHUB_URL = 'https://github.com/tpmanley'
SOCIAL = (('Twitter', 'https://twitter.com/tpmanley'),
          ('Github', 'https://github.com/tpmanley'),
          ('LinkedIn', 'https://www.linkedin.com/in/tpmanley/'),)

DEFAULT_PAGINATION = False

Since I setup Fabric during the quickstart process, testing the new site is easy:

fab reserve

This builds and serves up the site at http://127.0.0.1:8000. The first thing that struck me is how nice it looks. Just another reminder that I'm not a frontend kind of guy.

Moving the content to Pelican was easy since it was already in Markdown. I just moved the static pages into content/pages/ and the single blog post (yeah, I don't write much) into content.

The last step was to publish the new site on Heroku. First I enabled the Heroku buildpack:

heroku config:set BUILDPACK_URL=https://github.com/getpelican/heroku-buildpack-pelican

Then I removed the web: line from the Procfile so now it is empty. Finally I committed all the changes and pushed to Heroku like normal. And that was basically it!

Only thing left to do is start writing more, and maybe replace the default theme.

Comments !

social