Soaring with Pelican

Posted on Fri 19 May 2017 in Dispatches • 3 min read

Pelican logo

Get Pelican: it’s good!

There comes a time in every young man’s life when he begins to neglect his digital lawn, and the weeds grow so thick you wouldn’t think there was any home there at all. Such has been the state of Ministry for the last year. I have done a poor job keeping this place in shape, and the years of content could no longer make up for the lack of anything new. I could not blame you, gentle reader, if you had long ago assumed I had moved on. I might have thought the same.

It’s well past time to rectify that. Time to slap on a new coat of paint, make some improvements, and more importantly do some serious landscaping.

This site is now powered by Pelican, a Python static site generator. I’ve been a happy user of Jekyll for several years, since I first moved away from my custom Django-based CMS, but I’ve always had my little frustrations with it. For example, changing out your theme in Jekyll was a tedious experience. Themes live inside the same repo as your content, and can be a bear to switch around. You could easily spend days tweaking the theme inside a branch. The Octopress project had been working on a more flexible theming system, but I eventually gave up waiting to see when it would be production ready.

Pelican, on the other hand, completely separates the content from the presentation. In general, your theme lives in an entirely different repo, and your configuration file —or a command line flag— determines which theme to use to generate the site. In other words, you could try 10 different themes in less than that many minutes. That’s a very nice feature.

This process also encourages you to build more portable content. The biggest hurdle when switching to Pelican was the amount of Liquid tags that accumulated in my posts from Jekyll plugins. In retrospect, that was crazy, but short of writing the HTML by hand, there wasn’t an obvious way to get at what I wanted with fancy block quotes, pull quotes, etc., and plugins were the accepted community approach. In Pelican, that’s explicitly frowned upon. Your posts should be made up of Markdown, ReStructured Text, or HTML. That’s it. You can still achieve the same effect, but you don’t do it by slapping template language into a post. Instead, in my case, you work with Python’s exceptional and extensible implementation of Markdown, which allows you produce your desired effects without shifting syntax mid-post, and greatly increases your ability to take the same content elsewhere, even to something other than a SSG.

Another big plus is the speed at which it generates my site. From an empty content cache, Pelican generates my site in 50% of the time that it took with Jekyll, and with the content cache enabled, it goes down to roughly 25-30% of the time. That’s a big deal when you are making small changes and what to see the results quickly while running your local development server.

And of course, the biggest benefit, no messing around with setting up a ruby environment. It may be that it’s due to my deeper familiarity with Python, but virtualenv is orders of magnitude easier to set up than rvm.

From a visual standpoint, I settled on Flex as my base theme. It’s responsive, minimal, and has most of what I need. I’ve tweaked it a bit to provide support for pull quotes, tables of contents for posts, and a number of other small enhancements. I’m quite pleased with the final look. Sometimes the look and feel of the final result is half the joy of writing the content.

Speaking of content, I’ve also done some pruning here. I used to do a lot of bookmark importing back in the old CMS days, and that resulted in a number of lazy posts that didn’t have any commentary at all in them. That’s a waste. I’ve deleted all those old, worthless entries, and some of the shorter ones as well. I may yet cut away more. Sometimes it’s best to weed out everything that doesn’t please you, and see if you can make something worthwhile grow in its place.

Welcome back, reader. Take a look around. Explore the place. I’ll be over by the flower beds. If you have any thoughts or feedback, feel free to reach out.