sblg — static blog utility

How do I write articles?

Posted by
Kristaps Dzonsons
on

Articles are fragments or full XML documents (usually HTML5). The simplest article is structured as follows:

<article data-sblg-article="1">
  <header>
    <h1>Title</h1>
    <address>Kristaps Dzonsons</address>
    <time datetime="2013-01-01">1 January, 2013</time>
  </header>
  <aside>
    The article's <b>summary</b>
  </aside>
    <code>Mu.</code>
</article>

An article is any element with the data-sblg-article="1" Boolean attribute, usually <article data-sblg-article="1">. The article publication time is parsed from the first <time datetime=""> first <header>. The title is parsed from the first <hn> tag (where n = 1–4), as is the author from the <address> tag. These are used to order articles on the main page and title the article page. Both of these are optional — the system will default to Untitled article, Unknown author, and the file's ctime, if no information is otherwise provided. Furthermore, the first <aside> is used for the Atom summary.

Articles are linked into a front page template as follows (and omitting the surrounding HTML stuff):

<body>
  <nav data-sblg-nav="1" data-sblg-navsz="1"></nav>
  <article data-sblg-article="1"></article>
</body>

Here, the <article data-sblg-article="1"> is replaced by ordered article data, with a little permanent link thing following. The <nav data-sblg-nav="1"> is replaced by newest-first blog posting history. The rest is up to you. The sblg(1) manual contains all the details.