Changing link destination in Tiddler tag on static site?

In the static build of my wiki, the tiddler tags aren’t very useful: they’re yellow pills with a pointer cursor on hover but the click does nothing. Can I update the static build so that the tag links to a page that matches the tag name?

1 Like

You need to find the template that generates the static tiddlers and change the way it handles tags. It would be better to clone the static tiddler export and create a seperate custom export.

  • I think you can make use of a different template if generating from the command line with node.

I have done this in the past so the links in static tiddlers open in the parent wiki, not open seperate static tiddlers.

I found $:/core/ui/ViewTemplate/tags (GitHub) with the default tag output, calling $:/core/ui/TagTemplate (GitHub).

I modifed $:/core/ui/ViewTemplate/tags to use tv-config-static to conditionally show a different template when we’re in static rendering mode:

\whitespace trim
<$list filter="[<tv-config-static>match[yes]]" variable="ignore">
<$list filter="[all[current]tags[]sort[title]]" template="$:/custom/StaticTagTemplate"/>
</$list>
<$list filter="[<tv-config-static>!match[yes]]" variable="ignore">
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" retain="yes" animate="yes">
<div class="tc-tags-wrapper"><$list filter="[all[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/></div>
</$reveal>
</$list>

$:/custom/StaticTagTemplate is pretty simple:

\whitespace trim
<$link><$macrocall $name="tag-pill" tag=<<currentTiddler>>/></$link>

This seems to do what I want.

1 Like