Kristian Lyngstøl's Blog

My new blog

Posted on 2012-03-30

This is a blog post.

And it's written to test my blog scripts. I'd call it a "system", but that makes it sound like I think publishing my blog is a complicated process. It's not.

Right now, I'm writing in plain text in vim. I got fed up with blog "platforms" that just got in the way of actual writing. Suddenly I had to change browser to approve a comment? I had to wrestle with the software to get it to format stuff sensibly? What the heck....

So I figured, what do you actually need for efficient blogging? I came up with this:

  • The ability to easily write content.
  • Publishing tool
  • Some way of dealing with comments
  • Preferably some statistics
  • Some sort of tag-cloud
  • Archive.
  • Feed support

So how do I do this?

  • I use rst2html a lot.
  • I already publish my home page with Make and rsync to a web server.
  • Comments? Disqus.
  • Stats? Google analytics.
  • Tag cloud? 20 lines of awk-magic.
  • Archive? err.... it's just files in a directory. I figure the web server can handle that
  • Rss? Not gotten that far yet. I figure I find some tool that'll do the job, or I just write an rss generator myself. How hard can it be...

Now scroll to the bottom of this page and hit the 'view source' link.... A tiny bit of rst-magic and then plain text. If you are reading this on the blog front-page, the /index.rst file is actually auto-generated, using complex techniques to only show the last few blog posts. Techniques involving deep dark magic like a for-loop, ls -tr | head -n5 and the arcane cat-command. True sorcery.

Some files of interest:

You may notice that I'm using quite a lot of absolute URLs. This is to simplify reusing the text multiple places. Since this blog post is visible from post the index page and the posts/-page, it's easier to just use absolute URLs. Same goes for the top "menu", if you can call it that.

How long did I spend on this? So far I've spent about two hours on it. And I can now write a blog post without actually clawing my eyes out because some wysiwyg editor gets in my way. I wont have to worry about future-support either, because even if I DID want to go back to something fancy, I figure I can spend half an hour writing a script to convert the content to some import/export-friendly garbage.

The total code for this is so far 89 lines (excluding rsync).

I'll probably add a twitter-button soon-ish too. Can't be much work... So far, most of the work has really just been a mixture of deciding what I want and applying sufficient glue. I suppose I'll have to style this thing a bit too, though...

I figure I'll write this post as a sort of "0.5th" blog post, since I don't actually intend to abandon wordpress quite yet, but I figure there's nothing wrong venting here, and seeing what happens.