Can we have summary labels and folders like in Obsidian?

Hello everyone.

I have seen two Obsidian features that I would like to use in Tw, I don’t know if anyone knows a way to get them easily or if there is a plugin for this.

One is the ability to have child tags but only show the final part of them.

Example: In TW we would have a parent tag “Home” and from this a daughter tag “Home/Bills”. What I’m looking for is that it only shows the daughter “Bills”. With this I shorten their names and can refuse “Bills” in other contexts. When I search for them I do want the full name “Home / Bills” to appear to differentiate it from others like “Work / Bills”. Can this be done?

The other issue is about folders. Can something similar be done in TW?

Greetings and thank you.

1 Like

$:/core/ui/ViewTemplate/tags contains the template that renders the tags on a tiddler. It uses a list widget that will list each tag and render it using the $:/core/ui/TagTemplate tiddler.

That tiddler in turn uses the macro tag-pill-inner to create the content of the tag pills. Therefore, to change the behavior of the rendered tags, one option is to override the tag-pill-inner macro.

In a tiddler with the tag $:/tags/Macro/View, add this code:

\define tag-pill-inner(tag,icon,colour,fallbackTarget,colourA,colourB,element-tag,element-attributes,actions)
\whitespace trim
<$vars
	foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">>
	backgroundColor=<<__colour__>>
>
<$element-tag$
	$element-attributes$
	class="tc-tag-label tc-btn-invisible"
	style=<<tag-pill-styles>>
>
	<<__actions__>>
	<$transclude tiddler=<<__icon__>>/>
	<$text text={{{ [{!!title}split[/]last[]] }}} />
</$element-tag$>
\end

This way the tag pill will only display the last part of the tag, assuming you use “/” as a separator.

demo

3 Likes

Thank you very much Theophile.

I have managed to replicate the case successfully.

All the best.

I hope this works for you @Xabrina Personaly I would avoid using compound tags. I would be inclined to have three tags home, bills, work even if the tiddlers they tag have compound names eg “home bills”.

  • thus it is trivial to list all tiddlers with any combination.
1 Like

Thanks Tones.

I understand your advice, the problem is that I can do a TOC much faster and I can have labels of the same type in different contexts. Too many years with CherryTree type programs…

I have to change my way of organizing tiddlers but it’s hard for me… :sweat_smile:

Greetings.

One additional question. Could you do this same thing but with the title of the tiddlers so that it only shows what is after the “/”?

Greetings.

I will have to think more about this to understand and find a way around it. Forever an optimist :nerd_face:

  • Quick answer yes, look at the “View Template Title” cascade. You could set up a different template title for any “non system” title containing / and the title would be [{!!title}split[/]last[]]
2 Likes

here’s a demo of what @TW_Tones is talking about: demo

1 Like

Thanks @TW_Tones and @Theophile.

I figured it was possible to do the same as with the labels but I wasn’t sure.

If I wanted to make the “Recents” tab only show the shortened title, what would I have to modify?

Greetings.

The Recent tab is: https://tiddlywiki.com/#%24%3A%2Fcore%2Fui%2FSideBar%2FRecent