Pelican 3

· geek ·

Well. That ended up being a long interval between posts. I’m not really sure what happened. I’ve certainly been busy, but I managed to get myself into a kind of procrastination dependency loop. I wanted to write a new article, but I also wanted to upgrade to Pelican 3 (I was previously using Pelican 2), and I somehow persuaded myself that I need to do that before I wrote a new article. I didn’t upgrade, because I was imagining that it would be a long, difficult process, and I needed time to do it properly.

This was all nonsense of course. Pelican 2 was working fine for me, so there was no reason at all that I couldn’t continue to publish using the old version until I had the time to upgrade. In fact, this is one of the pleasures of working in Python with virtual environments: you freeze the versions of Python and the libraries that you use for each project, so upgrading other projects does not cause havoc. It’s a very stable system. My other reason was nonsense too, because upgrading to Pelican 3 turned out to be very straightforward too. I made a new folder, installed Pelican and the dependencies in it (in a new virtual environment), copied over the relevant bits of my configuration file and Makefile that I use to build the site, then copied over the contents/ and theme/ folders, which hold the source files and templates respectively. Then I built the site to test it and things mostly worked perfectly1.

I took the opportunity to convert the Typekit script to use the new asynchronous script, so the page should load quicker (initially without the custom fonts) if the connection to Typekit is slow, rather than blocking page load. I also fixed the tag page navigation, which had quietly been slightly broken for a while. In fact, I used the nifty new PAGINATION_PATTERNS setting to make pagination use clean URLs (without index.html).

So Pelican was impeccably behaved, and reminded me again why I like using static site generators (particularly this one). It’s generally very easy to upgrade the system by creating a copy of the old one, and testing locally until you are sure that you are ready to ‘flip the switch’ as it were.

The only (sizeable) fly in the ointment was that upgrading regenerated the Atom feed and marked all the articles as new again. This was particularly egregious for the poor souls subscribed to my Channel, whose phones and tablets went notification crazy as these old articles were heralded as new again. I’m so sorry about that, but there doesn’t seem to be anything you can do about it. I hate creating noise. Let’s hope that this post doesn’t set it all off again (brace yourselves @bazbt3, @jussipekonen and @matigo!).

  1. I did manage to forget to update my publishing configuration file with my site URL, so you may have briefly found this site with no styling, or broken URLs earlier today. ↩︎