Displaying fields when using tabs

Hi tiddlywiki-ers,

Given the following tiddler:

@@background-color:yellow;
Hello, my title is {{!!title}}
@@

When the above tiddler is displayed by the tabs macro this will show the name of the tabs tiddler (eg. MyTabs) and not the tiddlers actual title (eg. HelloWorld).

Is there a way to reference the original title when using tabs?

M

When a content tiddler is displayed in a tabset, the name of that tiddler is stored in the <<currentTab>> variable.

Thus, instead of using {{!!title}}, you could write <<currentTab>>, like this:

@@background-color:yellow;
Hello, my title is <<currentTab>>
@@

However… this would then not work if you ever want to display the content tiddler outside of a tab set (i.e., if you view it directly in the StoryRiver) because <<currentTab>> is only defined within the tabset.

To work around this, you can write your content tiddler like this:

<$tiddler tiddler=<<currentTab>>>
@@background-color:yellow;
Hello, my title is {{!!title}}
@@
</$tiddler>

By adding <$tiddler tiddler=<<currentTab>> at the start of the content, it sets the <<currentTiddler>> value to match the <<currentTab>> value, allowing the {{!!title}} field transclusion to work as before, but when displayed in the StoryRiver, <<currentTab>> is undefined, so the $tiddler widget is effectively ignored.

(ref: this technique is described at the bottom of the https://tiddlywiki.com/#tabs%20Macro documentation)

-e

1 Like

Hi @EricShulman that’s great, many thanks. Also I can now have <$link/> to go back to the original tiddler from the tabs view, M