View Recent tab entries, All tab entries, as <$link><$view field="caption"/></$link>?

Is there a way to view Recent tab entries, All tab entries, as <$link><$view field=“caption”/></$link>? So that the link goes to the actual title, but what is displayed is the caption field?

See the Link widget documentation and its use of the to parameter to set the real title, then between the $link open and close is where you set the display, in this case the caption, but I thought this was default behaviour. You should fall back to the title if not present as some tiddlers will not have a caption.

The content of the <$view> widget is displayed if the field or property is missing or empty.

  • So use the $view widget to display the caption and if thats missing inside it display the title.

The contents of the Recent tab is rendered using the timeline procedure, which is defined in $:/core/macros/timeline.

In that tiddler, you will find two additional procedure definitions:

\procedure timeline-title() <$view field="title"/>
\procedure timeline-link() <$link to={{!!title}}><<timeline-title>></$link>

To change how the timeline titles are displayed, you can create a separate tiddler, tagged with $:/tags/Global, containing a custom definition for timeline-title(), like this:

\procedure timeline-title() <$view field="caption"><$view field="title"/></$view>

This will cause the timeline procedure to display each tiddler’s caption field, with a “fallback” to showing the tiddler’s title field if no caption is defined.

Adjusting the “All” tab entries is a bit more involved (but still relatively easy)…

The contents of the “All” tab is rendered using the following line, defined in $:/core/ui/MoreSideBar/All:

<$list filter={{$:/core/Filters/AllTiddlers!!filter}} template="$:/core/ui/ListItemTemplate"/>

and the $:/core/ui/ListItemTemplate contains:

<div class="tc-menu-list-item"><$link /></div>

However, you don’t want to change the definition of $:/core/ui/ListItemTemplate, since it is used by the TWCore in several other places. Instead, you can just bypass the $:/core/ui/ListItemTemplate and change $:/core/ui/MoreSideBar/All to this:

<$list filter={{$:/core/Filters/AllTiddlers!!filter}}>
<div class="tc-menu-list-item">
<$link><$view field="caption"><$view field="title"/></$view></$link>
</div>
</$list>

enjoy,
-e

Thanks Tones and Eric!

I see Eric’s already solved your problem (as expected :wink: ) but I just wanted to add: If you’d like all your links to display the caption when available, @pmario’s uni-link plugin makes that easy:

It also includes a lot of other alias functionality, of course, but the caption-as-default affects normal links, so you can use it regardless of whether you’re using aliases. I’ve been using the plugin so long I tend to forget it’s not the default behavior!

1 Like