How to use an alternative label on tag pills

A long sought after feature by myself is to allow us to override the label on tag pills especially when using the tag macro.

  • A key use is to be able to show the a tag pill for the current tiddler if it is used as a tag, example included in this package adds it to the tiddler subtitle.
  • And other possibilities abound using the tag pill dropdown.
  • perhaps you have a use?, do share

labels-on-tag-pills.json (3.8 KB)

Use <<tag tagname label>> eg <<tag $:/tags/Macro Macros>> or see the included tiddler Current tiddler tagging? where it is conditional on the current tiddler being used as a tag.

  • <$macrocall $name=tag tag=<<currentTiddler>> label="tagging"/>

Try this on tiddlywiki.com

<$let label=" ">
<$list filter="[tag[TableOfContents]]">
<$link/> {{||$:/core/ui/TagTemplate}}<br>
</$list>
</$let>

We can also use the $:/core/ui/TagTemplate by setting the label variable.

<$let label=macros>
{{$:/tags/Macro||$:/core/ui/TagTemplate}}
</$let>

Note: This solution overwrites two core tiddlers, $:/core/ui/TagTemplate $:/core/macros/tag and with feedback I may submit a core change. Use the preview “differences from shadow (if any)” to ses the changes.

  • I think I will change the “label” variable to “tag-pill-label” to avoid accidental use of the label variable.

The Journey
This journey was fraught, as the tag macro uses a template as well as multiple additional macros. As is common for me with tiddlywiki in a flash of light, I realised how to do it, without causing my brain to explode.

  • For those that follow one trick was starting at the end and working back. I started where it displayed the tag title and worked back through the calling macros and template.
2 Likes