fork me on github

the blogging unengine

    follow me on Twitter
    Oct 10 2009 at 9:41 pm

    For the last couple of hours I have been hacking together a publishing mechanism, but it's not quite the blogging engine that we are all so used to.

    Now I, like every other python developer out there who has ever heard of django, have written my own blogging engine in it a couple of times, and played around with a couple of the more popular ones. With django I've done pingback and metaweblog via xmlrpc, a custom comment stack, facebook, flickr, and twitter integration, and a lot more. It's great.

    My requirements:

    But this time, constrained by the requirements above, I wasn't going to be able to do those things. Django needs real hosting, and my free options are pretty much one of the custom hosted blog systems above (all of which I have tried and don't like), or having my free hosting just serve static files.

    I chose the latter, and the free hosting service I'm using for that is github's pages. Which is especially nice, because my github profile is not a bad center for my online identity. By using github pages, the url for my blog is (not half bad), and all I have to do to update it is push my github repository named "".

    No, I'm not just writing HTML by hand to create blog posts. The technologies I'm using are just mako for templating, markdown for my entry format, and of course git for the uploading.

    The site content generation script searches for *.markdown files in the src/ directory, converts that markdown to html 4 and passes it into mako running the entry.html template (also using the last-modified date and figuring the post title from the filename), and generates an HTML file for each entry in the entries/ directory. It also collects a brief excerpt of each entry using truncate_html_words() poached from django.utils.text, sorts them by date and passes them into the index.html template.

    The great thing about all this is that I have found that I can do a pretty good job integrating with web services and having dynamic elements on my page entirely with javascript. So far I have data from github (via Dr Nic's github badge), twitter (with their javascript embed), and even powerful comments on my posts from disqus. I'm pretty stoked about what can be done with a totally static server and a little processing before uploading.

    The final touch was adding a pre-commit hook that runs the generation script and adds the generated files to the commit. So I really don't have to think about the generated files at all - as I'm committing my changes to the src/ directory, the changes propogate out to the rest of the repository and update the website then next time I push.

    I was thinking about how to separate the code that drives this system from the content. But in the end I was more interested in getting it up and running.

    Now to see if I update this thing at all. I have a couple of ideas for posts, but that does not a successful blogging endeavor make.

    blog comments powered by Disqus