I've decided to start a blog after Python package called Pelican caught my eye.
Pelican is a tool to generate a static blog from reStructuredText or Markdown input files. And most importantly it looks to be really fun, full python with jinja2 templating, which means it's fully extendable, configurable and modifiable as it's under GPL license.

Installing Pelican

Pelicans are cool
The setup for Pelican is pretty straightforward just run:

~> pip install pelican  # Installing Pelican package for python
~> mkdir blog && cd blog  # Create and jump into your blog directory!
~/blog/> pelican-quickstart
    ... #answer some simple questions here
~/blog/> vim content/first-page.md
    ... #write your blog here in simple markdown
~/blog/> pelican content  # regenerate website
~/blog/> cd output
~/blog/output> python -m pelican.server  # run pelican server to test locally

Now connect to http://localhost:8000 and there you go!
You can check here for how to template your message how to format your blog entry.

Vim markdown highlight for .md files

While going through the installation I've noticed that markdown doesn't have highlighting in vim which was peculiar. I found this post which describes a simple fix.
Simply create directories and file:


with content:

au BufNewFile,BufRead *.md  setf markdown

Theming Pelican

The default Pelican theme is pretty great however I stumbled on flex-theme on pelican theme repo on github. So that's my choice for now, but I'd like to touch up the color scheme a bit. Check out pelican-themes.

Configuring Pelican

A lot of bells and whistles come straight out of the box with the pelican and your theme. For example to setup Disqus commnets all I had to do is add DISQUS_SITENAME = "granitosaurus" where granitosaurus is my registered name of my disqus account.

Publishing Pelican

Since Pelican generates a static webpage you can use anything to publish it. I decided to use github user pages which is a bit more complicated than the docs make it out to be. For user pages I like to keep the whole source code in branch source and keep the generated output in master as per github's user pages rule. Then use ghp-import to automatically update master code with the most recent

$ git checkout -b source
$ pelican -o output -c publishconf.py
$ ghp-import output -b master -p

The above will make source branch, generate blog and push the output to master so it's viewable at https://username.github.io

NOTE The most important bit is to set SITEURL in your publishconf.py to https://username.github.io make sure it's HTTPS since default SITEURL generated by pelican is http and github pages requires https. This took me an hour of messing around to finally figure out.

Wrap Up

So far Pelican took quite a bit of work to get things going. It looks quite simple but there's a bunch of little quirks that are really hard to debug. It's not as easy as starting up a wordpress blog but it's quite fun and it seems to be really flexible.
Let's see if it pays off!

Checkout the source for more at https://github.com/Granitas/granitas.github.io/tree/source