sblg — static blog utility

How do I work with tags?

Posted by
Kristaps Dzonsons
on

Tags are useful for organising your content. As of version 0.1.1, you can specify tags for each article as follows:

<article data-sblg-article="1" data-sblg-tags="foo bar">
  <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 data-sblg-tags="baz">Mu.</code>
</article>

The <article data-sblg-tags=""> attribute indicates the tags of an article. In this article's case, that's foo, bar, and baz. You can have as many space-separated tags as you'd like.

Once you've added the tags, you can use them when generating <nav> entries in the blog amalgation. This is used in the index.html page of this site.

<nav data-sblg-nav="1" data-sblg-navtag="foo"></nav>

The above navigation element will only display entries with the foo tag. If you have multiple space-separated words in the data-sblg-navtag attribute, it will OR them together when selecting.