Bye bye Zine, hello Blogofile!

January 24, 2010 | categories: Blog, Python, Programming | View Comments

So only two posts have passed since I switched my blogging engine from PyBlosxom to Zine. Yesterday I moved again: From Zine to Blogofile. (This is turning into a blog about blogging software.)

What was wrong with Zine?

  • Zine brought my server to a halt a couple times before I realized that it was the large amount of (correctly marked) spam comments that made it use loads of resources. Deactivating comments fixed the problem. (Still, I really wanted them.)
  • The comments moderation screen couldn't cope with 100s of spam comments.

Yes, I could have looked into it and fixed it. I didn't like the idea though. First off, I'm debugging enough web apps in my daily work, and it's not what I want to do in my spare time. Secondly, debugging an application's memory consumption is not exactly something you do in one evening, at least not without prior knowledge of the codebase.

So I had my comments deactivated for a while, which sucked. And then came along Blogofile. Which is really similar to my former blog engine PyBlosxom in that your content lives on the filesystem, in plain text files, instead of being buried inside a database.

That means you can edit your content offline using your favourite text editor, build and push it to the server once it's done, instead of having to mess around with copy and paste and HTML text areas.

Other things I like about Blogofile so far:

  • Templating is very easy. I was able to apply my homepage's style in a matter of minutes.
  • All rendering is done once, offline. Then it's only static files on the server, no web app!

Just like with Zine though, using Pygments turned out not to work out of the box together with reStructuredText. (It does work fine with Markdown.)

Fortunately, Mike Bayer already did the work for me. All I had to make was some little tweaks. Supposedly this has to do with recent changes in Blogofile.

Update: Mike updated his Blogofile Hacks to work with the most recent Blogofile 0.7. All you should need to do is follow his instructions, and disregard the following ones.

First, I had to add this to my _config.py:

blog.post_default_filters = {
    "rst": "rst, syntax_highlight"
}

(Note how Mike is using blog_post_default_filters, with an underscore between blog and post.)

Then I changed his syntax_highlight.py slightly:

@@ -4,6 +4,11 @@
 from pygments import util, formatters, lexers, highlight
 import blogofile_bf as bf

+config = {
+    'syntax_highlight_style': 'murphy',
+    }
+
 css_files_written = set()

 code_block_re = re.compile(
@@ -39,8 +44,7 @@
 from mako.filters import html_entities_unescape

 def run(src):
-
-    style = bf.config.syntax_highlight_style
+    style = bf.config.filters.syntax_highlight.syntax_highlight_style
     css_class = "pygments_"+style
     formatter = formatters.HtmlFormatter(
             linenos=False, cssclass=css_class, style=style)

blog comments powered by Disqus