redoing my blog

After the last blog entry I got some feedback which (politely) suggested I stop whining and just use existing pyblosxom features. I didn't know that pyblosxom supports static, incremental blog rendering. And Tollef claimed to fix his pymarkdown plugin, although the updated version doesn't seem to do anything with my .mdwn files.

Anyway, I ended up spending far too much time today redoing how my blog is set up. I'll continue on into the gritty details, but anyone syndicating my blog should note that the new preferred url for the rss feed is http://kitenet.net/~joey/blog/index.rss, although the old url will keep working for now too.

static rendering

First I tried out pyblosxom's static page rendering. To make it work I had to reorganise my blog a bit, but it was worth it. I ended up with a simple Makefile, which runs the pyblosxom.cgi direct from the Debian package. No more need to copy and munge pyblosxom.cgi -- hurrah!

I did have to work around a pyblosxom static rendering annoyance. Actually a RSS annoyance: the absolute urls thing. Since I run a local copy of my blog on my laptop, and one on my server, I can't just hardcode a base_url like pyblosxom wants to for static rendering. One of the tricks in the Makefile and associated config.py is the use of the BASE_URL environment variable, which is based on the build machine's hostname.

I also had to set up some rewrite engine stuff, and make some other small changes to try to keep old links working as much as possible. I know of one place where I slightly failed, but it mostly seems ok.

With these changes and a hefty dose of moving everything around, I ended up with this source tree for my blog, in which I can just svn up && make to build my static pages in a second or two.

There are still some kinks. Notably, if I delete a blog entry, the static version stays around. And even modifications to blog entries will not be caught by the incremental run, since I also use the pyfilenamemtime plugin. I'm not sure what to do about that problem yet.

markdown

With the static rendering bit taken care of, I next tackled using markdown. Unfortunatly, I could not get Tollef's pymarkdown plugin to work properly.

After fighting with it for an hour, I sat down and in 15 minutes had hacked together a generic pyblosxom formatter which can easily be changed to use any command as the filter program.

You'd not want to use this if your pyblosxom blog were a CGI script, but once the leap to static html has been made, pyloxsom becomes just a big old compiler, and shelling out to an external perl program once for each new blog entry is not a big deal.

(That, by the way, is my most "significant" python program to date, and I found myself googling for stupid stuff like "python string concacentation" and "python backticks equivilant". One of these days, I may actually try to learn python instead of muddling around in it..)

Everything else

Hmm well, I've descibed 90% of my weblog setup now, I might as well finish up with the rest of it so it's fully documented. I use a few other plugins:

  • filtersvn is a hack someone wrote for me that makes pyblosxom ignore .svn directories.
  • I use the stock pyarchives.py to get archive links, etc.
  • pyfilenamemtime takes the ugly datestamp at the end of my blog entries and uses that instead of the file mtime.

    The reason I use this is because I keep my blog entries in svn, and I don't want any svn thing that changes all the mtimes to mess up the order of items in my blog. I'd really like to get rid of it, and it's not really needed most of the time, but it does come in handy when I nuke my home directory and check it back out of svn.

For writing entries I use a little blog script, that lets me edit a new entry in a text editor, then works out its filename, checks it into svn, and regenerates the weblog.

I think that's the lot. I'm obviously foolish for not just using livejournal, but all this work does give me a few minor benefits that seem worth it to me, at least some of the time.