sblg – static blog utility

v0.5.3, 2019-08-16

This is an example of an individual article. It consists of a template (article.xml) merged with article contents.

How does it work?

Posted by
Kristaps Dzonsons
on

It works like generating executables: with a Makefile like the one building this page (and the code) or by manual, cc(1)-like compilation. Click on file links to see the sequence—you'll get the point.

all: index.html index.html: index.xml article1.html article2.html: article.xml index.html: article1.html article2.html sblg -o $@ article1.html article2.html .xml.html: sblg -c -o $@ $<

Or in words, first build individual articles from a template with sblg -o article1.html -c article1.xml. Then knit together individuals into a templated front page with sblg -t index.xml -o index.html article1.html). The rest of this Makefile is dependencies. Not shown are Atom feeds: these use sblg -a atom.xml article1.html with a template just like the linking phase. See the sblg(1) manual for details.

I actually prefer to use the XML files as input to both the standalone and blog mode. This allows the rules to be run in parallel.

index.html: article1.xml article2.xml sblg -o $@ article1.xml article2.xml .xml.html: sblg -c -o $@ $<

Why do I do it like this? I prefer building articles individually, versioning the source with CVS, alongside templates for individual and linked articles. I let sblg do the work of putting it all together. Since most of my articles involve, for example, images built from gnuplot graphs, I already use Makefiles already to manage dependencies.