Hi all, I am experimenting, and not getting anywhere, so I have a couple of questions.
Is there a way to set up a viewtemplate tiddler so that if there are tiddlers tagged with the tiddler being viewed, the toc macro will appear under the tiddler content?
In the toc macro, how does one sort first by caption, then by title if there is no caption?
Update: replaced +[join[~]] with [join[]] in the above, as the tilde character was still showing up when the caption is empty. Other techniques are possible, but this seems simplest.
My setup isnât a full TOC, but may be useful to you or others.
I have a âTaggingFooterâ (tagged with ViewTemplate) with the following:
<<tag>> is tagging
<<dlist-link "[tag{!!title}]" " | ">>
</small>
where dlist-link is defined as a macro thus:
<$list filter="$filter$ +[butlast[]]"><$link/>$delimiter$</$list>
<$list filter="$filter$ +[last[]]" emptyMessage="nothing"><$link/></$list>
\end
<!-- tuned for $:/_local/TaggingFooter (esp the emptyMessage)
original from https://talk.tiddlywiki.org/t/macro-produce-a-delimited-list/1266/3 -->
<!-- etymology: "dlist" for delimited list. and link for the list being links -->
The result is not an expandable TOC, and has no sorting, but it consumes minimal space which is often a goal of mine. (I have it left aligned at the bottom of the tiddler, sharing the same vertical space as the author (âsubtitleâ) and date to the right, via some further CSS hints
It displays (and links to) each of the tiddlers that are linked from the one being viewed - that (to my interpretation) was the core of your query. My setup doesnât use the toc macro hence my disclaimers.
The shortcut is much nicer for many uses, but itâs less flexible, as you can only pass plain strings as arguments here. We need to pass <<currentTiddler>> so weâll have to use the longer format.
Obviously you would need to choose which TOC implementation you actually want. I usually choose toc-selective-expandable.
Here, with tiddlers like this:
title
caption
sort key
ABC
âABCâ
Tiddler 1
Foo
âFooTiddler 1â
Tiddler 2
Bar
âBarTiddler 2â
Tiddler 3
Baz
âBazTiddler 3â
Tiddler 4
âTiddler 4â
Tiddler 5
Qux
âQuxTiddler 5â
We would get this sort order:
ABC
Bar
Baz
Foo
Qux
Tiddler 4
I also made a mistake in the original (which I will edit right now) In the key, I joined fields to make the key with an actual character. (I used ~.) For technical reasons, that might cause problems when the caption is empty. So itâs updated to join on an empty string.
You can see this in action by downloading this and dragging the resulting file on any wiki: