I'm starting to blog again more regularly, but of course half the fun of having your own blog is mucking about with the technology that powers it. Encouraged by others who've recently made the switch, I've moved this blog over to the static page generation system Pelican.

I liked Mingus, but it really was overkill for what I need: regenerating a bunch of basically static pages for every request didn't make much sense, even if there weren't that many requests in the first place. I wasn't using any of the apps that came along with the basic blogging stuff: oembed, quotes, that sort of thing. And it seemed to me that if I was just typing in markdown and saving it, I might as well use a system that can take that markdown directly and just create a blog from it.

Well, that's exactly what Pelican does. No database involved, just a bunch of markdown files on disk and a script to convert them into formatted HTML pages via some Jinja2 templates. I write an entry in vim, save it into a specific directory, then run the pelican script which outputs the formatted pages. I've set up dropbox to sync that folder to my server, and that's all that needs to happen to publish a new blog entry.

As usual, I've customised things a bit. I didn't want to change the old URLs at all, so I've used the ARTICLE_PERMALINK_STRUCTURE setting to output files into directories by year/month/day (in hindsight, that was another bit of overkill from Mingus - one directory per month would probably have been enough). I've also set Apache to rewrite requests from slug.html to slug/, again so that the old URLs continue to work. Pelican has a CLEAN_URLS setting which means that files are created as slug/index.html, with the idea that you set Apache to serve the index.html automatically and other pages link to just slug/, but I didn't like the idea of yet another layer of subdirectories. So I've hacked it to split the setting into two: CREATE_CLEAN_URLS to control how the files are created, and LINK_CLEAN_URLS to determine how other pages link to them. Works nicely.


Comments

comments powered by Disqus