Publishing static sites with Pelican

There’s a lot of buzz from the hipsters about static site generation using Python and Ruby tools. A few that I just overheard while standing in line at Starbucks:

Despite being popular almost exclusively with hipsters, I can see the allure to static sites: no databases, blazing fast load times, focus on content, write blog posts in vim, push blog posts via git, etc…

Playing with Pelican

Because there are too many choices, and because I know at least one cool guy using it, I decided to give Pelican a try. Here’s a quick run through of a setup I did on my Arch Linux box; the steps should be mostly the same for other GNU/Linuxes, so extrapolate accordingly.

Install prerequisites:

$ pacman -S python-virtualenv

Create a workspace:

$ mkdir -p ~/src/git/blog
$ cd ~/src/git/blog

Anywhere will do, but as I intend to version mine in git, I’ll keep it where I keep my other git projects…

Create and prepare a virtual environment (with Pelican and Markdown):

$ virtualenv -p python2.7 .
$ source bin/activate
$ pip install Pelican==3.2 Markdown

Run the quickstart:

$ pelican-quickstart

Answer the questions as best you can… it’s not terribly important. All it’s doing is basically creating your pelicanconf.py, which is dead simple to fix manually later.

Create some content, content/firstpost.md:

Title: My first post
Date: 2013-07-10 22:33
Category: Pelican
Tags: pelican, publishing
Slug: my-first-post
Author: Alan Orth
Summary: My first post using Pelican

This is my first post using Pelican.  Now have a list!

* Linux
* ???
* profit!

Great success!

Build it!

$ make devserver

This basically runs the develop_server.sh script and then sends the server to the background (Ctrl-C won’t kill it). You can also use make stopserver and various other invocations of either to start/stop the server.

View it!
Navigate to http://localhost:8000

Basic Pelican-powered blog
Basic Pelican-powered blog

The vision

The long-term idea is that we, the Nairobi GNU/Linux Users Group, will:

  • make a Nairobi GNU/Linux organization on GitHub
  • add a repository for the blog contents
  • add LUG members to the organization, with push access to the blog repo
  • ???
  • profit!

I’m not sure if we’ll use Pelican or how we’ll get the static content to the server where nairobilug.or.ke currently points… but it sounds like a super fun, democratic way to get the community involved in blogging about GNU/Linux activities in Kenya, learn about git, etc. Hell, we could even redirect the nairobilug.or.ke site to Github and just host the blog there via GitHub Pages à la Martin Brocchaus

Anyways, wish us luck!

2 thoughts on “Publishing static sites with Pelican

  1. Honestly I’ve never heard of pelican before seeing it on nairobilug.or.ke, though I do know github and a bit of Linux. I love the work follow you guys have come up with, so sign me up for step 1 of The Vision.
    Good luck!

Comments are closed.