Creating a Simple Blog with sblg(1)

2019-02-16

I’ve created a simple blog to record my learnings here in tilde.institute. I wanted something easy to work with so I chose a utility called sblg(1) by Kristaps Dzonsons who has written a few OpenBSD applications. I found it after trying to work with another application he’d written, kcgi(1), and also his writing about the BCHS stack.

They were too hard so I thought I’d dial it back a bit!

The implementation was relatively straightforward, although there was some slight trickiness to it. The sblg site talks mostly about using xml, and only hints at markdown, for writing entries. But I didn’t want to write everything in xml so I installed an additional utility lowdown(1) to translate this markdown I’m writing now into xml first, and then build the blog from there.

I downloaded both the utilities from source, built them, then placed the binaries in ~/.bin. Then I wrote my article (this one) and worked with my makefile to get it to compile and build nicely. The one tricky thing I found was that the default layout for the index page of the blog is to list the date of the entry and the title. sblg gets the date from a <time> tag at the top of the xml. However, when I was parsing the markdown to xml, lowdown didn’t like the time tags and would instead wrap them in <p> tags, effectively hiding the date of the entry from sblg. I’m sure there’s a way around it to get the date of articles in the index, but I worked around it by just customising the display of the entries on the first page to only show the title. That was listed in this article.

One day I might style the blog. Who knows?