The IndieWeb proposes the use of microformats to build a decentralized social network: the IndieWeb.
The blog your are reading right now is based on IkiWiki, adding microformats to IkiWiki is a first step to adding it to the IndieWeb.
Microformats 2 is the
recent development of the microformats markup. It is advised, to use
them but still mark web pages up with
For easier authoring I have put together a
For marking up a blog, a perceived minimum of three microformats classes are needed:
- For giving details about a post (or article, respectively).
For marking up the author of the article inside the
- For marking up aggregations of posts.
The following is a stripped down HTML 5 source of the present article.
class attributes hold the microformat markup. Look out for
the following data (classic microformats in parenthesis):
- h-entry (hentry)
- p-name (entry-title)
- e-content (entry-content)
- rel="tag" (p-category)
- p-author (author), with h-card (vcard)
- dt-published (published)
- dt-updated (updated)
<article class="page h-entry hentry"> ... <span class="title p-name entry-title"> Simple Responsive Design for IkiWiki </span> ... <section id="content" role="main" class="e-content entry-content"> ... article text comes here ... </section> <nav> Tags: <a href="../../../tags/webdesign/" rel="tag" class="p-category">webdesign</a> </nav> <span class="vcard"> <a class="p-author author h-card" href="http://jorge.at.anteris.net">Georg Lehner</a>, </span> <span class="dt-published published">Posted <time datetime="2016-06-18T14:08:19Z" pubdate="pubdate" class="relativedate" title="Sat, 18 Jun 2016 16:08:19 +0200">at teatime on Saturday, June 18th, 2016</time></span> <span class="dt-updated updated">Last edited <time datetime="2016-07-23T13:48:28Z" class="relativedate" title="Sat, 23 Jul 2016 15:48:28 +0200">Saturday afternoon, July 23rd, 2016</time></span> </article>
Now lets look at a feed. In this case just a time ordered list of two posts. Follow the structure as you did above:
- h-feed (hfeed)
- p-name (entry-title): title of the feed.
- list of posts, each:
- h-entry (entry)
- u-url (bookmark)
- p-name (entry-title): title of the post
- dt-published (published)
- p-author (author), with h-card (vcard)
<div class="h-feed hfeed"> <span class="p-name entry-title"><span class="value-title" title="MagmaSoft Tech Blog: all posts list"> </span></span> <div class="archivepage h-entry entry"> <a href="./Microformats_for_IkiWiki/" class="u-url bookmark p-name entry-title">Microformats for IkiWiki</a><br /> <span class="archivepagedate dt-published published"> Posted <time datetime="2016-07-27T15:19:32Z" pubdate="pubdate" class="relativedate" title="Wed, 27 Jul 2016 17:19:32 +0200">late Wednesday afternoon, July 27th, 2016</time> </span> </div> <div class="archivepage h-entry entry"> <a href="./Simple_Responsive_Design_for_IkiWiki/" class="u-url bookmark p-name entry-title">Simple Responsive Design for IkiWiki</a><br /> <span class="archivepagedate dt-published published"> Posted <time datetime="2016-06-18T14:07:50Z" pubdate="pubdate" class="relativedate" title="Sat, 18 Jun 2016 16:07:50 +0200">at teatime on Saturday, June 18th, 2016</time> </span> <span class="vcard"> by <a class="p-author author h-card url fn" href="http://jorge.at.anteris.net">Georg Lehner</a> </span> </div> </div>
This should do for learning by example, if you need more, go to the http://microformats.org website.
Note: IMHO the markup looks overly complicated, due to doubling microformats v1 and v2 markup. Microformats v2 simplify things a lot, but Operator has no support for it (yet) and who else out there will have?!
Pages are rendered by IkiWiki via
using a fixed template:
page.tmpl. So are blog posts, as these are
simply standard wiki pages. The templates can contain variables, such
as the authors name or the creation date of the page, which are
inserted accordingly in the HTML code.
Note: One would like to avoid this extra typing. There are approaches which automate template selection, e.g. as discussed at the IkiWiki website here, however they are not yet available in the default IkiWiki code base.
We already explored the different options of aggregating several pages with IkiWiki on this website.
Two templates come into play for formatting the various posts involved:
For simple lists of posts, like the example for a feed used above.
When concatenating several posts, e.g. the five most recent ones, with all their contents.
Note: there is also a
microblog.tmpltemplate, which I have not used until now. Of course it will need a microformats upgrade too.
Accordingly I provide two modified template files which include the necessary microformats markup:
[[!inline pages="page(blog/posts/*) and !*/Discussion" show="5" feeds="no" template="mf2-inlinepage" pageinfo]]
[[!inline pages="page(./posts/*) and !*/Discussion" archive=yes quick=yes trail=yes show=0 template="mf2-archivepage" pageinfo]]
But this does not give us a feed markup!
Ideally the inline directive should create the
microformats markup for
h-feed by itself. This would need a major
change in IkiWiki's code base and of course has to be discussed with
the IkiWiki authors and community. In the meantime I wrote a wrapper
template: h-feed, which can be used to enclose an
inline directive and wraps the rendered post list into a
Note: it is not trivial to mark up the
h-feedautomatically. Feeds have required and optional elements which might be made visible or not on the page. The question is, how would the inline directive know which information to show whether to put it on top or below of the list of posts and which text to wrap it into - think multiple languages. A possible solution would be a
feedtemplateparameter with which you can select a template wrapping the in-lined pages. The you can adapt the template to your taste. A default template provided by IkiWiki could be similar to the h-feed template.
Finally for the lazy readers: here comes the complete live example for h-feed. We'll show the archivepage example (simple list of posts):
[[!template id=h-feed.mdwn name="MagmaSoft Tech Blog: all posts list" feed=""" [[!inline pages="page(./posts/*) and !*/Discussion" archive=yes quick=yes trail=yes show=0 template="mf2-archivepage" pageinfo]] """]]
IkiWiki runs several passes to compile the given wiki source tree into
html pages. During these passes a lot of meta data is gathered for
each wiki page. However, as explained in a
IkiWiki does not supply much of this information in the
To harvest the meta data already available I prototyped a new "IkiWiki"
feature, which I call
pageinfo. It adds a new valueless parameter
inline and the
template directive as can seen in the above
examples. If it is present, information in the global hash
%pagestate is made available
to the template as
Plugins can be written, which add information to
%pagestate in early
passes of the IkiWiki compiler.
The precise location for a given variable of a certain page in
Note: This approach should be expanded somehow to take the information from the
metaplugin into account.
The canonical way to declare authorship of an IkiWiki page is by using
parameter. This is (sic) not available to templates or the
directive. Additionally, you must set it by yourself manually for
In the pageinfo prototype of IkiWiki two new rcs hooks are added,
which gather the creator and the last committer of a file. The sample
get_authors plugin uses this information with a map in the setup
file to convert the rcs author information to the authors name and URL
and provide them as
modifier_url. These variables are present in the above described
Note: I am not happy with this first attempt. It is rather heuristic and already needs two hooks to implement for each type of rcs. In a real world wiki a page can have a lot of contributors, not just the first and the last one. Should we care?
At http://at.magma-soft.at/gitweb you can find the
ikiwiki.git repository. In the same location you will find
ikiwiki-plugins repository with the