In the same scenario, how to display the caption instead of title in the TOC (e.g. $:/core/ui/MoreSideBar/All and $:/core/ui?moreSideBar/Recent)?
Hi Hsins,
The TOC already uses the caption field if a tiddler has one. Eg:
- Go to tiddlywiki.com HelloThere
- Edit the tiddler
- Add a caption field â Youâll see it in the TOC
The Recent Tab uses the timeline-macro, which would need to be changed.
There is no way at the moment that it uses caption instead of title.
More Sidebar All uses the ListItemTemplate which would also need a change.
We donât let âcaptionâ overwrite every listing.
So what is your usecase?
I just saw the demo from TiddlyWiki è â ćșç€æ件æŁé«äžæç and wonder for how it be done. It always shows captions instead of titles. Thatâs not my usecase but thanks for your reply:)
I also want this, so with 5mins of digging,
by look at $:/core/macros/timeline
and found it is un-modified, so I read the comment in the code:
<!-- Override one or both of the following two macros with a global or local macro of the same name
if you need to change how titles are displayed on a timeline -->
\define timeline-title() <$view field="title"/>
I realized there must be a tiddler modify the timeline-title
, so I just use Advanced search for it, and found:
http://tw5-zh.tiddlyspot.com/#%24%3A%2Fcore%2Fmacros%2Ftimeline-title
\define title() <$view field="title"/>
\define timeline-title()
<$set name="tv-wikilinks" value="no">
<$set name="display" tiddler=<<currentTiddler>> field="caption" emptyValue=<<title>>>
<<display>>
</$set>
</$set>
\end
So just drag this tiddler to your wiki, it will works.
Another methjod in 5.3.x is
\function display-title() [all[current]get[caption]else{!!title}]
<<display-title>> <!-- this returns text -->
Or in a link
<$link><<display-title>></$link> <!-- this still links to the tiddler "title" -->
You could create a switch to show caption if available, or turn it off to always show the title.
A much more compact way to write this:
\define timeline-title() <$view field=caption><$view field=title/></$view>
By default, the $view
widget displays the specified fieldâs value as plain text. However, if the specified field is blank or doesnât exist, then the widgetâs inner content is rendered. Thus, the above will display the current tiddlerâs non-blank caption text with a fallback to the tiddlerâs title.