Getting a title into a <$set> command via a filter and using it in <$link to=...> construction

I’m doing something wrong! Suggestions?

(paste into tiddlywiki.com)

<$list filter="[tag[HelloThere]]"><<currentTiddler>><br></$list>
<$set name="first" filter="[tag[HelloThere]first[]]">

``
1 <<first>>>works <br>
2 <$link to=<<first>>>First</$link> does not work. Why?<br>
``


1 <<first>>>works <br>
2 <$link to=<<first>>>First</$link> does not work. Why?<br>

One of those things, I’m probably just being blind to the obvious. Thanks, //steve.

When you use $set with a filter, it can store a list of tiddler titles. As a result, any titles that contain spaces are automatically enclosed in doubled square brackets, even if there is only one matching tiddler. Then, when you use that saved result in the $link widget to=<<first>> parameter, the doubled square brackets are still there, so the link tries to open [[A Gentle Guide to TiddlyWiki]].

There are two ways to fix this:

  • add “select=0” to the $set widget to choose the first result and automatically remove the doubled square brackets:
<$set name="first" filter="[tag[HelloThere]]" select=0>
  • or, use a $let widget with a “filtered transclusion”, which always uses the first result from the filter (and also removes the doubled square brackets):
<$let first={{{ [tag[HelloThere]] }}}>

I recommend the second method. It’s shorter and easier to read, with less complex syntax.

enjoy,
-e

2 Likes