So today I’ve updated my blog again - I no longer administer it through the web at all, instead I write it using markdown in a terminal, and push the published version to my server.
I contemplated going with Jekyll, Blogofile or something similar, but decided against. The amount of configuration required on all the options I looked at seemed crazy - I just want to write text, dammit.
About My Blog Engine
So, my blog engine consists of essentially three commands:
- generate
- list_drafts
- serve
Generate
Generate will create the content to disk, and attempt to upload it to the server via ssh (using my upload script).
List Drafts
list_drafts will list all unpublished drafts. Pretty simple.
Serve
Serve will, you guessed it, serve the pages. It spins up a simple http server with a tiny change - url rewriting for nice urls, the same as the production site does.
Implementation
So, some more implementation information:
- YAML for configuration.
- Jinja2 for the template.
- My upload script for uploading it to the server.
- Fabric for managing the blog, generating and uploading the files, spinning up the SimpleHTTPServer instance.
Settings file
Here’s my settings file:
site_name: Nathan Hoad
author_name: Nathan Hoad
domain: http://www.getoffmalawn.com
meta:
keywords: nathan hoad, nathanhoad, git, blog, projects, django, python, programming, c++, android
description: I'm Nathan Hoad and I'm a computer programmer who blogs about my findings in Python, and software development in general
author: Nathan Hoad <nathan@getoffmalawn.com>
static_path: /static/
stylesheets:
- master.min.css
upload:
host: nathoa11@getoffmalawn.com
destination: getoffmalawn.com/
header_links:
- text: Blog
href: /
- text: About
href: /about/
- text: Contact
href: /contact/
atom_feed:
name: recent.atom
title: "Recent Blog Posts"
generate_frontpage: yes
blog_matches_frontpage: yes
generate_sitemap: yes
It’s pretty straight forward for the most part, so I won’t explain it all. Basically, the entire settings file is accessible from your template, so anything global you’d like to configure for the whole site, put it in this file. There’s a single, global template used by everything, because this is meant to be simple.
The only ugly part of the settings file, in my opinion, is the ending. blog_matches_frontpage
is a crappy piece of configuration, and it’s a horrid hack. When I started with this revamp, I decided I was going to get rid of the front page as it was originally. I felt it was awkward and didn’t really offer anything.
But what should I replace it with, I wondered. In the end, I opted to put a giant list of blog posts sorted by date, but then I had no nice way to put anything at /blog/index.html. So generate_frontpage
tells the engine to generate /index.html from the blog posts, and blog_matches_frontpage
tells the engine to generate it for /blog/index.html too. When I get around to it I plan on fixing that mess so it’s not so bad. But not right now.
Losses in functionality
Now that the entire website is static, there are, of course, some losses in functionality. Users can no longer view posts by archive, or search, and there’s no tagging. They aren’t really important though, I mean, if you’re here to read, you’re here to read, right? Not perform queries. So I don’t count it as a loss really.
I’ve also opted to remove SyntaxHighlighter from the site. I don’t feel as though the syntax highlighting really provided anything either. Now it’s all just HTML and CSS.
Conclusions
As per usual, I think this current iteration of my blog is better than the last. I’m sure the next version will be rendering plaintext, or sending physical mail or something like that. Can’t wait!
If anyone is interested in the source, let me know and I’ll publish it. It’s quite ugly, but hey, it’s free, and you might inspire me to tidy it up :)
About the biggest thing the engine is missing at the moment is a name. Maybe something cool, like Schreiben. That won’t be hard to Google for at all.