$:/tags/ViewTemplateTitleFilter, additional tags and list-before

Please see Styling individual words in titles for context.

The solution to this problem works great (but see reply Styling individual words in titles - #16 by Jan). It comprises among other things creation of a tiddler named (for instance) $:/config/ViewTemplateTitleFilters/caption with the tag $:/tags/ViewTemplateTitleFilter and an empty field list-before.

It is easy to forget the existence of this tiddler. One might think a solution is to also add a current-tiddlywiki-specific tag (which I did). However, this interferes with the solution. The list-before field now refers to the order of the tiddlers tagged with this additional tag, and if this order is changed, specifically if the $:/config/ViewTemplateTitleFilters/caption is no longer first, then Tiddlywiki removes the list-before field and the (beautiful) solution no longer works.

May (I hope) or may not be useful to know since it is not immediately obvious why adding an additional tag and changing the order of unrelated tiddlers makes the markup of titles disappear.

There are two ways to control the order of tiddlers that have a tag in common with each other:

  • set a ‘list-before’ (or ‘list-after’) field on the tiddler you wish to control. Note that if the list-before field is left blank, then it means “at the start of the list” (or, if list-after is left blank, then it means “at the end of the list”).

  • using drag-and-drop, set the order of tiddlers for a given tag by viewing that tag (i.e., <<tag sometag>>). Click on the tag to see the list of individual tiddlers with that tag, and then interactively drag-and-drop to change the order in that list. This method does not rely upon the list-before (or list-after) field. Instead, it stores the order for all tag-related tiddlers in the list field of the tag itself. In addition, using this method automatically removes any list-before (or list-after) fields on the individual tiddlers. This is necessary so that the order specified by the tag’s list field will by properly applied.

As you’ve noted, the first method works only when the individual tiddler in question belongs to just one “tag group” and that tag group is never manually re-ordered by drag-and-drop.

So, you might ask: what is the value of the first method if it is so “brittle”. Typically, the first method is generally effective when the tagged tiddler is part of a plugin, since when intially installed, the plugin can’t possibly know what other tags you intend to apply to that tiddler for your working TiddlyWiki environment, and if that individual tiddler has only one tag, then manually re-ordering the tiddlers will still produce the same desired result.

However, as you’ve also noted, when a tiddler has multiple tags and you interactively re-order the items for any one tag, this “initial install” method of tag sorting stops working. In this case you must do the same (i.e., interactively re-order the tagged tiddlers) for each of those multiple tags so that each tag can independently apply its own list field.

Sure, it may not be intuitive, but this approach DOES work for your specific use-case situation.

Hope this helps,

-e

3 Likes

Thanks for the extra explanation!
Jan