DevOps Within

Stories from a man against the machines.

Blogging with Pelican

Bloggin', bloggin' and rollin'

(Consider this a theme song for this post. Enjoy! I know segulls != pelicans, but it's close enough.)

Okay, I guess I am a sort of a hipster. I prefer the bottom half of a bread roll to the top one, use SaltStack instead of Puppet, work on my code on Gitlab instead of GitHub and run a static blog on Pelican instead of Jekyll.

To be honest, on a basic level most of static website generators are pretty similar. It's hard to say which one is THE best objectively. I'd like to show why I chose Pelican instead of others and what are it's basic features.

The curse of abundance

Static website generators have seriously boomed over the last few years, especially with GitHub releasing GitHub Pages in 2008. When I started thinking about finally starting a blog, I was sure that I ddn't want anything based on popular CMS (e.g. Wordpress). I believe in KISS principle so I didn't want to make this too complicated to host and create.

So I found this page showing list of static website generators and their popularity. I thought that this might help me make a choice... Well, at least I had a list to choose from!

I had some bad memories of getting Jekyll and Ruby to work on development environment (I might have been unlucky) so I decided to work with something that I know pretty well - Python-based system. Of those, the most popular is Pelican so I have decided to use it.

Things I like about Pelican

Easy bootstrap

The process of starting a development environment is very easy. Assuming that you're using virtualenv (which you should):

  1. Create virtualenv and install required packages:

    $ virtualenv my-blog
    $ . my-blog/bin/activate
    $ pip install pelican markdown
    
  2. Quickstart the site:

    $ pelican-quickstart
    
  3. After answering some questions, project is waiting for you to start hacking!

      my-blog/
      ├── content
      │   └── (your posts)
      ├── output
      ├── develop_server.sh
      ├── fabfile.py
      ├── Makefile
      ├── pelicanconf.py       
      └── publishconf.py
    

Posts written in Markdown

The most popular markup language in today's world. I have always wanted to learn all shortcuts and symbols of Markdown, but I wasn't using those often enough to keep them in my mind for long. Now I have a ~~method~~ to do so. How do I strikethrough? Doh.

Templates coded in Jinja2

Jinja is one of the most popular templating engines in Python, with Mako close and django's templating very similar. I use jinja extensively in my day-to-day work as it's also used as a templating engine in SaltStack management system. Since I wanted to create my own theme for the blog, this was a great boon for me.

Plugins system

There is an exerexpanding library of plugins for pelican available on GitHub. While I still cannot find use for most of them, it's good to have some choice, right?

Build system can be run anywhere*

* I assume that Python is available almost anywhere nowadays.

It's very easy to build the site and run a development server. Just activate the virtualenv you're created earlier and then run make devserver. Or, if you don't have make available, install fabric (pip install fabric) and run fab serve. Then just open http://localhost:8000 and view the results.

Things that I don't like

Documentation

I feel that the documentation is sometimes lackluster in examples showing how to do some things - especially regarding theming. But I have to admit that all possible configuration options are there and described correctly.

Looking for some meat?

This was just some basic information about a viable and fun to use alternative to other static website generators. I'll surely get back to this topic later on, with some hacks, features and my favourite plugins.

Feel free to share your experiences and opinions about static websites versus typical CMS-based ones.