[TW5] How to Transclude all tiddlers with a tag

2,379 views
Skip to first unread message

Nolan

unread,
Oct 2, 2015, 7:43:29 PM10/2/15
to TiddlyWiki
Reading through this discussion with Jeremy https://github.com/Jermolene/TiddlyWiki5/issues/121  it sounds as though I should be able to transclude the content of multiple tiddlers based on their tags using the following

<$list filter="[tag[myTag]]">
<$view field="text" format="wikified"/>
</$list>

I've tried this a number of times using that exact syntax (I created a couple of tiddlers with a "myTag" tag) and all I'm getting is the plain text contents of the tiddlers, nothing appears to be wikified.  I'm sure there is something basic I'm missing.  Any help would be appreciated.

Tobias Beer

unread,
Oct 3, 2015, 2:05:57 AM10/3/15
to TiddlyWiki
Hi Nolan,

use the TranslcudeWidget...

<$list filter="[tag[myTag]]">

<$transclude mode="block"/>
</$list>

with heading links...

<$list filter="[tag[myTag]]">

<h1><$link><$view field="title"></$link></h1>
<$transclude mode="block"/>
</$list>

for some-other-field as a definition list...

<dl>
<$list filter="[tag[myTag]]">
<dt><$link><$view field="title"></$link></dt>
<dd><$transclude field="some-other-field"/></dd>
</$list>
</dl>

Best wishes,

— tb 

Evolena

unread,
Oct 3, 2015, 3:35:11 AM10/3/15
to TiddlyWiki
Le samedi 3 octobre 2015 01:43:29 UTC+2, Nolan a écrit :
Reading through this discussion with Jeremy https://github.com/Jermolene/TiddlyWiki5/issues/121  it sounds as though I should be able to transclude the content of multiple tiddlers based on their tags using the following

<$list filter="[tag[myTag]]">
<$view field="text" format="wikified"/>
</$list>


Since this discussion (2013), there has been a modification of the view widget: it doesn't support "wikified" format anymore. A wikified view is in fact a transclusion.

Nolan

unread,
Oct 3, 2015, 4:35:59 AM10/3/15
to TiddlyWiki
Thank you, Tobias!

Your first option was exactly what I was looking for.  

Diego Mesa

unread,
Oct 20, 2017, 6:46:38 PM10/20/17
to TiddlyWiki
Just wanted to note for completeness:

I tried using Tobias second suggestion to show the titles and the text, but for some reason that only showed the titles for me. I could not figure out why. I editted it like:

<$list filter="[tag[Research]tag[Journal]!sort[created]]">
<br/>
<h2><$link><$transclude field="title" mode="block"/></$link></h2>
<$transclude field="text" mode="block"/>
<br/>
<hr/>
</$list>

And this is how I am able to have a `Research Journal` tiddler, that collects all the individual journal entries into one.

barro...@gmail.com

unread,
Apr 15, 2019, 12:12:32 AM4/15/19
to tiddl...@googlegroups.com
this thread just refuses to die << >>

posting to add what I found to work also in case anyone finds this thread in searching for an answer to this subject

<$list filter="[tag[#book page]]">

<$link><$view field="caption"/></$link>

<$transclude field="text" mode="block"/>
</$list>



and something even more simple


<$list filter="[tag[#book page]]">

<$link><
<currentTiddler>> </$link>

{{!!text}}

</$list>



Geoff Tothill

unread,
Jun 9, 2020, 9:05:05 AM6/9/20
to TiddlyWiki
Thanks to everyone who has contributed to this thread - it seems popular!

I have a slightly different requirement if anyone can help me with it.

I need to transclude a relatively large number of tiddlers and display the tags in the transcluded content wrapped in their graphical form (lozenges).

This should give me a list of the titles of all tiddlers tagged with a primary tag as well as displaying the transcluded tiddlers tags - in the form of lozenges. Effectively I want to do this to use tags as status indicators for each of the transcluded tiddlers and display that in a list.

Does anyone know if this is possible?

Thanks in advance!

Geoff.

Eric Shulman

unread,
Jun 9, 2020, 9:51:31 AM6/9/20
to TiddlyWiki
On Tuesday, June 9, 2020 at 6:05:05 AM UTC-7, Geoff Tothill wrote:
I need to transclude a relatively large number of tiddlers and display the tags in the transcluded content wrapped in their graphical form (lozenges).
This should give me a list of the titles of all tiddlers tagged with a primary tag as well as displaying the transcluded tiddlers tags - in the form of lozenges.
Effectively I want to do this to use tags as status indicators for each of the transcluded tiddlers and display that in a list.

Give this a try:
<$list filter="[tag[...primary tag goes here...]]">
   __<$link />__
<br>
   <$list filter="[
<currentTiddler>tags[]]" variable="currentTag">
      <$macrocall $name="tag" tag=<
<currentTag>> />
   </$list>
<br>
   
<blockquote><$transclude mode="block"/></blockquote>
</$list>

* The outer $list finds all tiddlers with the "primary tag".  Then, for each matching tiddler:
* The next line shows the title of the current tiddler (as an underlined link)
* The inner $list get all the tags for the current tiddler
* The $macrocall inside the inner list invokes the "tag" macro, which shows the tag "pill" for each tag found
* The blockquote (which is outside of the inner list) transcludes the content of the current tiddler

let me know how it goes...

enjoy,
-e

Geoff Tothill

unread,
Jun 9, 2020, 3:49:14 PM6/9/20
to TiddlyWiki
Eric,

Wow! Thanks so much for such an amazingly quick reply.  I just tried it and I think its going to be exactly what I was trying to achieve.

Also, its going to give me something to unpick and learn from.

Thanks again, it is much appreciated.

Cheers

Geoff.

Geoff Tothill

unread,
Jun 9, 2020, 4:01:07 PM6/9/20
to tiddl...@googlegroups.com
Hi Eric,

It works perfectly, but I have discovered a problem with my grand plan, which I should have predicted.

Many of the tags are repeated in the new tiddler, as they are transcluded, and when one is clicked, all the others also produce drop downs of their associated tiddler titles.

Is there any way of stopping that behaviour on a per tiddler basis so that the tags displayed by your filter code are not clickable.  Or even, at a push, all tags globally are rendered non clickable?

Again, any pointers would be very much appreciated,

Geoff.

PS I just found this, which I think is pertinent from Tobias - https://github.com/Jermolene/TiddlyWiki5/pull/2628 - but I'm not clear whether this was ever resolved? 


On Tuesday, June 9, 2020 at 2:51:31 PM UTC+1, Eric Shulman wrote:

Eric Shulman

unread,
Jun 9, 2020, 4:48:35 PM6/9/20
to TiddlyWiki


On Tuesday, June 9, 2020 at 1:01:07 PM UTC-7, Geoff Tothill wrote:
It works perfectly, but I have discovered a problem with my grand plan, which I should have predicted.
Many of the tags are repeated in the new tiddler, as they are transcluded, and when one is clicked, all the others also produce drop downs of their associated tiddler titles.
Is there any way of stopping that behaviour on a per tiddler basis so that the tags displayed by your filter code are not clickable.  Or even, at a push, all tags globally are rendered non clickable?

There *is* a workaround that allows the tag popups to be displayed individually... but it's a subtle bit of a trick.  First... a little technical background info:

The tag pill popup is defined in the $:/core/ui/TagTemplate shadow tiddler, and uses this line to control when it is displayed
<$reveal state=<<qualify "$:/state/popup/tag">> type="popup" position="below" animate="yes" class="tc-drop-down">
Note the use of <<qualify ...>> in the $reveal state parameter.  The qualify macro (see https://tiddlywiki.com/#qualify%20Macro) "returns a unique string that encodes its position within the widget tree, as identified by the stack of transcluded tiddlers that lead to that position."  Thus, the result of the <<qualify>> macro returns the same value for all items shown in the same tiddler.  To force each tag pill occurrence gets a uniquely qualified state value, we need that value to be calculated from a different position on the "stack of transcluded tiddlers".  We can achieve this by splitting the tiddler content into two tiddlers so that we render the tag pill from a different tiddler.

Here's what you need to do:

1) Rewrite the previous version of the code like this:
<$list filter="[tag[... your tag here ...]]">
   __<$link />__
<br>
   <$list filter="[
<currentTiddler>tags[]]" variable="currentTag">
      {{||ShowTagPill}}
   </$list>
<br>

   
<blockquote><$transclude mode="block"/></blockquote>
</$list>

Note how
<$macrocall $name="tag" tag=<<currentTag>> />
has been replaced with a transclusion of a separate "ShowTagPill" tiddler
{{||ShowTagPill}}

2) Define the "ShowTagPill" tiddler, containing just the previous $macrocall
<$macrocall $name="tag" tag=<<currentTag>> />

That's it.  Now, when the "tag" $macrocall is invoked, it will be from a different position in the transclusion stack, resulting in a different -- and unique <<qualify>> value for that tag pill.

The effect is that clicking on one tag pill will only open the popup for that instance of the tag pill, and will no longer open the popup for ALL occurrences of the same tag pill.

Hopefully, this explanation wasn't too confusing!...Give it a try and let me know how it goes.

enjoy,
-e


Geoff Tothill

unread,
Jun 10, 2020, 3:31:51 AM6/10/20
to TiddlyWiki
Eric,

Thanks for taking the time to answer this in so much detail, again, it's given me not only a solution but something to learn too.

I'm going to make those changes and I'll report back.  I wonder why this workaround isn't in the core?  There is probably a consequence that I wont see until I start playing with it though.

What I love about Tiddlywiki is that there always seems to be several ways of achieving a functional result in a creative way.

Thanks again, I'll let you know how I get on.

Cheers,

Geoff.
Reply all
Reply to author
Forward
0 new messages