Looking At a Python Pelican

I really like the static version of the site. It's so much easier to support and configure. I can tweak to my hearts content. Jekyll is a wonderful platform, and Octopress is a great framework on Jekyll. However, ruby isn't my strength. I've fiddled with ruby in the past, but I don't love it. It is a great language, just not for me.

If I'm perfectly honest, I love perl. Perl was an early first love, and is still a terrific language, but the static site generators in perl are limited. I did take a look at Blosxom, but there isn't a large number of active users. I did find one site with current posts built using Blosxom, so it's still out there.

Python is a close second in my list of favorite programming languages. It's strictly typed, lovely to read, and quite popular.

When looking for static site generators, there is a lot of terrific information out there...just google. This site, Static Site Generators, is a great resource. It lists most and can be sorted by License, Language, likes (stars), and more information.

In the world of static site generators, there are two leading the race for python: Pelican, and Hyde. Hyde looks great, and has a bit of a following, but Pelican seems to be a bit further along and seems to have a larger community behind it.

Requirements

My site doesn't have a lot of technical requirements. Here is a list of my needs, and a list of wants:

Needs

  • Must support multimarkdown with footnotes.
  • Multiple rss, including rss for my podcast, MPRP.
  • Mobile first design.
  • Clicky analytics.
  • Quick site generation and deployment.
  • Good looking and easy to read.

Wants

  • Social link add in.
  • Full text search.
  • Related posts option.
  • Most popular posts option.

Design

The look is the hard part. I'm not a designer. In fact, I'm horrible at design. But I know what I like.

Probably the most popular Pelican user, Macdrifter's site has a great design. Easy to read, clean and intuitive. Wonderful! It has features I like:

  • Two column design
  • Large easy to read fonts
  • Good use of icons
  • Search in the navigation bar

So I decided to start from scratch. Well, nearly scratch. Bootstrap is my starting point of choice. I have some familiarity with the framework, and know it will give me what I want.

The pelican-bootstrap3 theme looks like a good place to start. Adding a theme is pretty simple. Adding the local location with the THEME keyword to the config file should do the trick.

Initial Setup

First things first, getting pelican installed was a piece of cake. The instructions work as expected, and the simple make commands work as advertised. Very similar to the process in Jekyll.

make html generates the site.

make serve hosts the site on http://localhost:8000 for quick review.

Add Content

I found a great starting script to read through all of my post markdown files, and convert the yaml headers to the headers used by pelican. I found a terrific script by Jan-Piet Mens, jek2pely.py, and with just a few minor tweaks, it quickly converted the thousand or so post files.

Images is a pretty easy convert as well. Pelican expects to find everything in a content folder. Everything in the folder is either posts, pages, or other needed items. So, I copied the images folder as is from Jekyll to Pelican. Then a quick search and replace for all files changing:

{{ root_url }}

to

{filename}

and images are ready to go!

By default, the images folder is copied to output. Additional folders can be setup using the following in pelicanconf.py:

STATIC_PATHS (['images'])

See the docs. There are tons of configuration options.

Here's what day one looks like:

![pelican2screenshot-2013-10-13-14-36-00][15]

[15]: {{ site.url }}/images/pelican2screenshot-2013-10-13-14-36-001.png

I'll continue fiddling with the new site. If I get the layout and workflow setup they way I like, I'll probably end up replacing my Jekyll site with this Pelican site.

FYI - site generation time even with 1019 posts is just over 38 seconds on my trusty macbook air.

Enjoy!