blogging with Pelican and Github pages

Hey! Welcome to my new blog.

So, when it came to setting up a blog again, I didn't want to go the old route to Livejournal / Blogger / Tumblr. Too much Y2K, Google, and teenage girl angst, respectively. Svbtle & Ghost cost money, and Medium's focus is on the platform, not you. That's when I remembered Github pages allows you to setup a free static site.

First create a new Github pages repo called username.github.io, where username is your Github username. Create a new folder locally to store the site files (I like to keep website files tidy in /var/www/):

mkdir /var/www/username.github.io
cd /var/www/username.github.io
git clone https://github.com/username/username.github.io

To save time on building a site, I first tried using Jekyll, but found the instructions unclear and the setup seemed needlessly complex. Apart from that, why is it so difficult to install anything Node related on Debian (though a friend has the same issue on Fedora, so maybe it's a Node thing)?

Then I found Pelican, which allows you to write content using markdown and renders site templates into HTML using Jinja. It's also much easier to install and get running!

pip install pelican

Site content goes in a content/ folder inside the pelican install directory, and individual pages start with simple metadata:

Title: My super title
Date: 2010-12-03 10:20
Modified: 2010-12-05 19:30
Category: Python
Tags: pelican, publishing
Slug: my-super-post
Authors: Alexis Metaireau, Conan Doyle
Summary: Short version for index and feeds

This is the content of my super blog post.

To preview the site locally, run a Python web server, then check localhost:8000:

cd output
python -m SimpleHTTPServer

To publish your content live, back in the main site directory run the following commands:

pelican
cd output
git add --all
git commit -m "my first commit"
git push

Of course, there's lots of other things you can do, like changing or customising the default theme. Read the docs here (wish more projects used read the docs!