I came across this when working on converting my old blog into an ikiwiki, but I think it could be of more general use.
The background: I have a (currently suspended, waiting to be converted) blog on the il Cannocchiale hosting platform. Aside from the usual metatadata (title, author), il Cannocchiale also provides tags and two additional categorization namespaces: a blog-specific user-defind "column" (Rubrica) and a platform-wide "category" (Categoria). The latter is used to group and label a couple of platform-wide lists of latest posts, the former may be used in many different ways (e.g. multi-author blogs could have one column per author or so, or as a form of 'macro-tagging'). Columns are also a little more sophisticated than classical tags because you can assign them a subtitle too.
When I started working on the conversion, my first idea was to convert Rubriche to subdirectories of an ikiwiki blog. However, this left me with a few annoying things: when rebuilding links from the import, I had to (programmatically) dive into each subdirectory to see where each post was; this would also be problematic for future posting, too. It also meant that moving a post from a Rubrica to the other would break all links (unless ikiwiki has a way to fix this automagically). And I wasn't too keen on the fact that the Rubrica would come up in the URL of the post. And finally, of course, I couldn't use this to preserve the Categoria metadata.
Another solution I thought about was to use special deeper tags for the Rubrica and Categoria (like: \[[!tag "Rubrica/Some name"]] ), but this is horrible, clumsy, and makes special treatment of these tags a PITN (for example you wouldn't want the Rubrica to be displayed together with the other tags, and you would want it displayed somewhere else like next to the title of the post). This solution however looks to me as the proper path, as long as tags could support totally separate namespaces. I have a tentative implementation of this tagtype feature at my git clone of ikiwiki.
The feature is currently implemented as follows: a tagtypes config options takes an array of strings: the tag types to be defined aside from the usual tags. Each tag type automatically provides a new directive which sets up tags that different from standard tags by having a different tagbase (the same as the tagtype) and link type (again, the same as the tagtype) (a TODO item for this would to make the directive, tagbase and link type customizable). For example, for my imported blog I would define
tagtypes => [qw{Categoria Rubrica}]
and then in the blog posts I would have stuff like
\[[!Categoria "LAVORO/Vita da impiegato"]]
\[[!Rubrica "Il mio mondo"]]
\[[!meta title="Blah blah"]]
\[[!meta author="oblomov"]]
The body of the article
\[[!tag a bunch of tags]]
and the tags would appear at the bottom of the post, the Rubrica next to the title, etc. All of this information would end up as categories in the feeds (although I would like to rework that code to make use of namespaces, terms and labels in a different way).
Note [[plugins/contrib/report/discussion]]. To quote myself from the latter page:
I find tags as they currently exist to be too limiting. I prefer something that can be used for Faceted Tagging http://en.wikipedia.org/wiki/Faceted_classification; that is, things like Author:Fred Nurk, Genre:Historical, Rating:Good, and so on. Of course, that doesn't mean that each tag is limited to only one value, either; just to take the above examples, something might have more than one author, or have multiple genres (such as Historical + Romance).
So you aren't the only one who wants to do more with tags, but I don't think that adding a new directive for each tag type is the way to go; I think it would be simpler to just have one directive, and take advantage of the new [[matching different kinds of links]] functionality, and enhance the tag directive.
Perhaps something like this:
\[[!tag categorica="LAVORO/Vita da impiegato" rubrica="Il mio mondo"]]
Part of my thinking in this is to also combine tags with [[plugins/contrib/field]], so that the tags for a page could be queried and displayed; that way, one could put them wherever you wanted on the page, using any of [[plugins/contrib/getfield]], [[plugins/contrib/ftemplate]], or [[plugins/contrib/report]].
--[[KathrynAndersen]]
A very generic metadata framework could cover all possible usages of fields, tags, and related metadata, but keeping its user interface generic would only make it hard to use. Note that this is not an objection to the idea of collapsing the fields and tags functionality (at quick glance, I cannot see a real difference between single-valued custom tagtypes and fields, but see below), but more about the syntax.
I had thought about the \[[!tag type1=value1 type2=value2]] syntax myself, but ultimately decided against it for a number of reasons, most importantly the fact that (1) it's harder to type, (2) it's harder to spot errors in the tag types (so for example if one misspelled categoria as categorica , he might not notice it as quickly as seeing the un-parsed \[[!categorica ]] directive in the output html) and (3) it encourages collapsing possibly unrelated metadata together (for example, I would never consider putting the categoria information together with the rubrica one; of course with your syntax it's perfectly possible to keep them separate as well).
Point (2) may be considered a downside as well as an upside, depending on perspective, of course. And it would be possible to have a set of predefined tag types to match against, like in my tagtype directive approach but with your syntax.
You seem to have answered your own objections already. -- K.A.
Point (3) is of course entirely in the hands of the user, but that's exactly what syntax should be about. There is nothing functionally wrong with e.g. \[[!meta tag=sometag author=someauthor title=sometitle rubrica=somecolumn]] , but I honestly find it horrible.
So, really, point 3 comes down to differing aesthetics. -- K.A.
A solution could be to allow both syntaxes, getting to have for example \[[!sometagtype "blah"]] as a shortcut for \[[!tag sometagtype="blah"]] (or, in the more general case, \[[!somefieldname "blah"]] as a shortcut for \[[!meta fieldname="blah"]] ).
I would like to point out however that there are some functional differences between categorization metadata vs other metadata that might suggest to keep fields and (my extended) tags separate. For examples, in feeds you'd want all categorization metadata to fall in one place, with some appropriate manipulation (which I still have to implement, by the way), while things like author or title would go to the corresponding feed item properties. Although it all would be possible with appropriate report or template juggling, having such default metadata handled natively looks like a bonus to me.
Whereas I prefer being able to control such things with templates, because it gives more flexibility AND control. - K.A.
Flexibility and control is good for tuning and power-usage, but sensible defaults are a must for a platform to be usable out of the box without much intervention. Moreover, there's a possible problem with what kind of data must be passed over to templates.
Aside from the name of the plugin (and thus of the main directive), which could be tag , meta , field or whatever (maybe extending meta would be the most sensible choice), the features we want are
- allow multiple values per type/attribute/field/whatever (fields currently only allows one)
- allow both hidden and visible references (à la tag vs taglink)
- allow each type/attribute/field to be exposed under multiple queries (e.g. tags and categories; this is mostly important for backwards compatibility, not sure if it might have other uses too)
- allow arbitrary types/attributes/fields/whatever (even 'undefined' ones)
Each type/attribute/field/whatever (predefined, user-defined, arbitrary) would thus have the following parameters:
directive : the name of the directive that can be used to set the value as a hidden reference; we can discuss whether, for pre- or user-defined types, it being undef means no directive or a default directive matching the attribute name would be defined.
linkdirective : the name of the directive that can be used for a visible reference; no such directive would be defined by default
linktype : link type for (hidden and visible) references
linkbase : akin to the tagbase parameter
queries : list of template queries this type/attribute/field/whatever is exposed to
Where this approach is limiting is on the kind of data that is passed to (template) queries. The value of the metadata fields might need some massaging (e.g. compare how tags are passed to tags queries vs cateogires queries). I have problems on picturing an easy way to make this possible user-side (i.e. via templates and not in Perl modules). Suggestions welcome.
|