sblg(1) is a utility for creating static blogs: it knits together articles and templates, generating static HTML files and Atom feeds. It's built for use with make(1), as blogs depend upon articles, etc. No markdown, no CMS, no CGI, no PHP. Just a simple tool for pulling data from articles and populating templates. sblg(1) is an ISC licensed ISO C utility that depends only on libexpat. (Where simple encompasses Atom feeds, multi-language support, tag filtering, etc.)

How does it work? You write your HTML content and templates; sblg(1) pulls content and metadata from the articles and merges it into the templates (usually orchestrated with a Makefile). There are two basic ways of populating templates: a standalone mode, which pasts a single article into a template; and amalgation mode, which posts multiple articles. Amalgamation mode can merge entire articles as well as just article snippets and metadata for navigation and summary purposes.

To get started, download sblg.tar.gz (SHA512), decompress, and run make install. The current version is 0.3.3, released on . The repository is mirrored on GitHub, if that's easier for you.



Articles are just content within the <article data-sblg-article="1"> tag of an HTML (or really XML) document. sblg(1) pulls articles and article metadata for populating navigation elements and article elements in the templates. The following is an example article:

<?xml version="1.0" encoding="utf-8"?> <article data-sblg-article="1"> <header> <h1>Title</h1> <address>My Name</address> <time datetime="2014-04-12">2014-04-12</time> </header> <aside> This is pulled out for the page synopsis. </aside> <p> And here we have some <q>content</q>. </p> </article>

You'll also need a template. For standalone mode, this is just a regular HTML file where the <article data-sblg-article="1"> tag is replaced by the page contents.

<!DOCTYPE html> <html> <head><title>${sblg-title}</title></head> <body> <article data-sblg-article="1"></article> </body> </html>

For amalgamation (blog) mode it's the same; however, you can also specify <nav data-sblg-nav="1"> to fill in meta-data from all articles passed into the command. The <article> elements will be filled in with articles.

<!DOCTYPE html> <html> <head><title>My Blarg</title></head> <body> <nav data-sblg-nav="1"></nav> <article data-sblg-article="1"></article> <article data-sblg-article="1"></article> <article data-sblg-article="1"></article> <article data-sblg-article="1"></article> </body> </html>



A Makefile makes this easy. Pretend that your articles (article1.xml, article2.xml) are source code. Then object files (article1.html, article2.html) are compiled from single articles and a template, article.xml. Binaries (index.html are compiled from object files (or directly from sources) and a template, index.xml.

XMLS = article1.xml article2.xml ARTICLES = article1.html article2.html   all: index.html $(ARTICLES)   index.html: index.xml $(ARTICLES) sblg -o $@ -t index.xml $(ARTICLES)   .xml.html: sblg -o $@ -t article.xml $<



To read about the system, read the sblg(1) manual. I take great care in making sure that the manpage is up to date; less so the non-canonical howto and FAQ documents. That said, this is about blogs, so you might as well have some bloggy stuff. Obviously, this page itself was generated using sblg(1)!