Is List Grouping Using Tags or Tiddler Fields Possible?

95 views
Skip to first unread message

Darth Mole

unread,
Jun 23, 2021, 11:16:54 PM6/23/21
to TiddlyWiki
I currently am using the toc macro on pages to automatically display tiddlers that are considered sub-tiddlers in specific categories. I’m using tags to do this. 

IE: The Settlements tiddler has a toc macro to display all tiddlers listed as a settlement type via the tags. 

The only problem is that the sub-tiddlers won’t appear until I’ve made an individual tiddler, tagged with the Settlements tag, for them to be grouped under in the toc. The toc is based on tags AND tiddlers/tiddler titles, not just the tags. 

I know there is the list macro but I don’t see how you can limit the list of tiddlers by one tag (ie: Settlements) and then group them by a second tag (ie: Outpost). Especially if the tiddlers have more than 2 tags. 

I also came across the list grouping by tiddler type, and thought perhaps there is a way to do the grouping with a custom tiddler field at the bottom of the tiddler but I haven’t been able to make it work. 

Is it even possible to do what I want? I don’t want to have to make a placeholder tiddler for every settlement, organization, geography, etc., type regarding the toc macro when there isn’t a guarantee even a fraction of them would be used. 

Is there perhaps a way to make a hierarchy in the tags using a naming convention that will do what I want? IE: Settlement/Outpost

Thanks!

PMario

unread,
Jun 24, 2021, 3:50:26 AM6/24/21
to TiddlyWiki
If you want to group something you'll need real tiddlers. Otherwise you will get the problems you describe..

You may be interested in the tocP macro which allows you to create tocs based on fields. The default is the parent field. But it can be any field name. .... BUT you still need tiddlers


-m

Darth Mole

unread,
Jun 24, 2021, 2:42:10 PM6/24/21
to TiddlyWiki
Thank you very much for clarifying PMario!

Darth Mole

unread,
Jun 24, 2021, 4:31:46 PM6/24/21
to TiddlyWiki
Hello!

So I'm not sure if there was some confusion between PMario and I or what but I was able to figure it out! :D (Sorry, really giddy even though I'm still a little uncertain the details of the solution lol).

<$list filter=[has[sett-type]each[sett-type]]>
<div class="tc-menu-list-item">
''<$view field="sett-type"/>''
<$list filter="[contains:sett-type{!!sett-type}!is[system]sort[title]]">
<div class="tc-menu-list-subitem">
<$link to={{!!title}}><$view field="title"/></$link>
</div>
</$list>
</div>
</$list>

I have several Tiddlers each with a custom "sett-type" field with a subsequent value. I may have three Tiddlers listed as Town and two listed as City

IE: sett-type: Town or sett-type: City

The above code filters all Tiddlers with the sett-type field and then groups them by their sett-type field value.

IE: 

City
   City 1
   City 2

Town
   Town 1
   Town 2
   Town 3

The big deal, at least for me, is now I don't need placeholder Tiddler's for City or Town regarding the toc code. I can replace the toc code on the main "Settlements" page (the Settlments index basically) with the above filtered list and get the same dynamic effect without the need for placeholder tiddlers.

Happy mole! 

<(^.^<) <(^.^)> (>^.^)>


Reply all
Reply to author
Forward
0 new messages