After a decade or so with a website that was just a single paragraph containing the following:
Now we are being herded into the nineties, which looks like it is going to be a true generation of swine, a decade run by cops with no humor, with dead heroes, and diminished expectations […] at the end of the decade, no one will be sure of anything except that you must obey the rules, sex will kill you, politicians lie, rain is poison, and the world is run by whores. These are terrible things to have to know in your life, even if you’re rich. Since it’s become the mode, that sort of thinking has taken over the media, as it has business and politics […] This vilification by Nazi elements within the media has not only given me fierce joy to continue my work - more and more alone out here, as darkness falls on the barricades … —Hunter S. Thompson
it was time to actually do something with the site. I’ve tried before, but each time I ended up writing blogging software instead of contents. I really enjoyed writing that software, but it didn’t result in a website.
This time I decided to go with Pelican, a static site generator. I’ve found that I’ve enjoyed using a static site generator, and there are many ways it does things that I’ve preferred to something like Wordpress.
Simplicity was important to me, and a static site generator is just a collection of text files - one for each blog entry, and one for each page on the site. Everything else is generated automatically, even the looks, RSS feeds and site navigation. The files I write only contain the contents of the blog entries, I don’t have to supply anything else. This reduces overhead and complexity for myself.
I’m able to write the pages and blog entries on my own machine, even when it’s disconnected from the network, and I can use any tools I want. I don’t need a browser - I just need a text editor, and I can pick the one I prefer (Vim of course).
I store the source to the blog in Mercurial (a distributed version control system, like Git), and I have a post-commit hook on my server which builds the site when I perform an hg push. That is - all I have to do to publish a new article, or version of the site is to type hg push on my local machine, and the final result is uploaded to my server. The post commit hook just runs make html and places everything in a directory for Nginx to serve up. I was inspired to set that up by Sam, who linked to a description of how his blog used it in a G+ update. It feels trivially easy to produce an update.
The blog entries themselves are written in ReStructuredText, which is a very simple markup language. It’s almost purely plain text, much simpler than most wiki markup. It’s similar to Markdown. I picked ReStructuredText over Markdown because I wanted to become more comfortable around RST.
Pelican also supports plain HTML, and it works remarkably well. If you already have some pages written in HTML, they can just be copied right in. The theming is so simple, even someone like myself can manage it. There are also a lot already created, including ones that build on Twitter Bootstrap.
There are a lot of alternatives to Pelican, such as Octopress, Nikola, Jekyll, Hyde, etc. I picked Pelican because it was the first hit on Google; that is as complicated as my decision got. With contents written in RST, moving to another static site generator would be trivial, so I wasn’t too worried about my choice. I’ve been really happy with Pelican, and I will happily recommend it to anyone who feels comfortable with running their own web server.
What does it look like?
Now we are being herded into the nineties ######################################### :date: 2013-07-03 10:20 :tags: pelican, python, web :category: geekery :slug: rawmeat-pelican-blog :author: Rikard Anglerud :summary: Rawmeat.org rebuilt using the Pelican static site generator. After close to a decade with a website that was just a single paragraph containing the following:
That is this top of the file that defines this blog entry, and it really is that easy. Nothing to it!
Over and out, darkness is falling.