How do I show tags along with tiddler title in the search result?

152 views
Skip to first unread message

talha131

unread,
Jun 14, 2019, 5:31:00 PM6/14/19
to TiddlyWiki
I use tags to organize my tiddlers. In search result only title of the tiddlers is displayed. I want it to also show the tags of the matching tiddlers.

### Use Case

Say I have two tiddlers about `JSON`. One is for JavaScript and the other one has details about JSON in golang.

When I search for JSON, the result shows both the tiddlers but I have no way of knowing which tiddler is the one I am currently interested in.

### Work around

I can add description in the title like `JSON in Golang` but it makes titles too long. And if I have to add tags in the title then it defeats the purpose of the tags field.

### Nearest solution

So far, the only solution I have found is


But it has not been updated since 2014. Moreover, it shows too much information when all I need is a tag.

Please let me know how can I modify search results to shows tags and title.

Mat

unread,
Jun 14, 2019, 6:19:39 PM6/14/19
to TiddlyWiki
Every tiddler consists of fields. One field is the title field. Another is the tags field. They can be transcluded using this form {{!!fieldname}}.

Thus inside a listwidget, you could write {{!!title}}, {{!!tags}}

See if this achieves your result. Chances are you'll want them to be links also, in which case you use the linkwidget. (BTW, the syntax for this is about to be improved in the very-soon-to-be-released 5.1.20 version.)

<:-)

talha131

unread,
Jun 15, 2019, 2:41:41 AM6/15/19
to TiddlyWiki

(BTW, the syntax for this is about to be improved in the very-soon-to-be-released 5.1.20 version.)

I am actually using 5.1.20 pre release. Can you please point me to the documentation of the to be release version?

Mat

unread,
Jun 15, 2019, 3:46:39 AM6/15/19
to TiddlyWiki
Sure, here's the linkwidget and here's the discussion on the update of it. In summary, you can use <$link/> to get a link to the current tid instead of a much longer syntax for 5.1.19. So, in the listwidget, instead of writing {{!!title}} you write <$link/>.

<:-)

talha131

unread,
Jun 15, 2019, 7:23:01 AM6/15/19
to TiddlyWiki

Thank you Mat for the details.


I think what I want to do can be achieved by editing $:/core/ui/ListItemTemplate.

It reads

<div class="tc-menu-list-item">
<$link to={{!!title}}>
<$view field="title"/>
</$link>
</div>

I just need to add

<<tag-pill>>

What I can’t figure out is how to pass the current tag to the tag-pill macro. I have tried

<<tag-pill {{!!tags}}>>
<$macrocall $name="tag-pill" tag=<<__tags__>> />

But they didn’t work. Of course my syntax is incorrect but I can’t figure out the correct one.

Mat

unread,
Jun 15, 2019, 7:43:17 AM6/15/19
to TiddlyWiki

What I can’t figure out is how to pass the current tag to the tag-pill macro. I have tried

<<tag-pill {{!!tags}}>>
 General note: both the <<..>> syntas and {{..}} are short forms of macrocalls. As such they cannot be nested.

<$macrocall $name="tag-pill" tag=<<__tags__>> />
Well, the tags field of course often contain multiple tags so if you want to use the tag-pill macro (or the tag macro) then you must surround the macrocall with a listwidget so that the macrocall only deals with one tag at a time.

<:-)

talha131

unread,
Jun 15, 2019, 8:31:17 AM6/15/19
to TiddlyWiki
<<tags>>

works fine.

It’s the <<tag-pill>> macro that is not working.

you must surround the macrocall with a listwidget so that the macrocall only deals with one tag at a time.

Can you point me to any example where listwiget is used in this way?

Mat

unread,
Jun 15, 2019, 8:58:21 AM6/15/19
to TiddlyWiki

you must surround the macrocall with a listwidget so that the macrocall only deals with one tag at a time.

Can you point me to any example where listwiget is used in this way?

Didn't test this but should work:

<$list filter="my tiddlers of relevance">
   <$link/>
   <$list filter={{!!tags}}>
      <$macrocall $name=tag-pill tag={{!!title}} />
   </$list>
</$list>


<:-)
<:-)

talha131

unread,
Jun 15, 2019, 12:32:54 PM6/15/19
to TiddlyWiki

Thanks a lot Mat. My issue has been solved.

<div class="tc-menu-list-item">
<$link to={{!!title}}>
<$view field="title"/>
<$list filter={{!!tags}}>
      <$macrocall $name=tag-pill tag={{!!title}} />
   </$list>
</$link>
</div>

Mohammad

unread,
Jun 15, 2019, 1:12:51 PM6/15/19
to TiddlyWiki
Added to TW-Scripts

bimlas

unread,
Jun 17, 2019, 12:52:19 AM6/17/19
to TiddlyWiki
talha131,

The Locator plugin is made to find related tags easier, it shows the tags in search results as well.

https://bimlas.gitlab.io/tw5-locator/

talha131

unread,
Jun 17, 2019, 8:05:09 AM6/17/19
to TiddlyWiki
Thank you bimlas. Much appreciated. I did give it a try. It's not the solution I was looking for.

bimlas

unread,
Jun 17, 2019, 8:17:13 AM6/17/19
to TiddlyWiki
talha131,

Forgive me, but according to your description, this is what you are looking for, but it may not be clear how it works. In a GIF I show you how you can filter the search results by tags.

https://i.imgur.com/MPdirls.gif

If the description is not really clear, please let me know.

talha131

unread,
Jun 17, 2019, 9:03:41 AM6/17/19
to TiddlyWiki

What I was looking for

See these images

I was searching for the word diff and json. These are common words in the programming world and more than one topics have tiddlers on it. I needed a simple way to tell these tiddlers apart with a glance.

I didn’t need to narrow down my search via tag or open other tiddlers from the tag pill. Just wanted to have a little bit context in the search result that a tiddlers is from which topic.

Feedback on Locator

It’s a powerful plugin.

  1. Its documentation can certainly be improved. It wasn’t clear that you need to add some tiddlers to get it working.
  2. Usage is not clear either. If you add a gif or YouTube video it will certainly be helpful

My take away is that it’s useful for users who have thousands of tiddlers with hundreds of tags in the TW. So far I have only 663 tiddlers and 77 tags, so TW default search is good enough. For now.

bimlas

unread,
Jun 18, 2019, 1:47:59 AM6/18/19
to TiddlyWiki
Ok, I understand now what you wanted to achieve, the locator is really inappropriate.

Thank you for the advice, I will somehow clarify the documentation.

I don't know exactly where, but I seen you earlier, maybe somewhere in the Vim era.

talha131

unread,
Jun 19, 2019, 2:28:19 AM6/19/19
to TiddlyWiki

I don’t know exactly where, but I seen you earlier, maybe somewhere in the Vim era.

I too recall you from somewhere but can’t put my finger on it. ☺️It’s probably from Vim, perhaps #vim irc channel. I used to be active on it couple of years ago. :)

Reply all
Reply to author
Forward
0 new messages