On Sunday, November 10, 2019 at 8:42:39 PM UTC-8, mageykun wrote:
>
> Per: https://tiddlywiki.com/static/Tagging.html
>  
>
>> Change the order in which tags are listed
>> By default, tagged tiddlers are listed in alphabetical order. 
>
> If you want any other order, add a list field to the tag tiddler, and set 
>> its value to be a list of the tiddlers in that order.
>
>
> I'm relatively new to using Tiddlywiki, and the explanation provided here 
> hasn't been sufficient for me to figure out how to get tags to appear in a 
> desired order.  Where is the "tag tiddler" I need to edit (is this a shadow 
> or system tiddler somewhere?), and what syntax is expected for this list?
>
> For example, if I have "Example Tiddler" with tags "A" "B" "C", what do I 
> actually have to do to get the tag pills to appear in order "B" "A" "C"?
>

The documentation refers to the order of "tagged tiddlers"... not the order 
of the tags themselves.  Thus, if you have three tiddlers, "foo", "bar", 
and "baz", all tagged with "A", you can create a tiddler named "A", in 
which you define a field named "list", with a value of "baz foo bar".  
Then, if you view any of those tiddlers and click on the tag pill labeled 
"A", you will see a droplist showing the *tagged* tiddlers in the order, 
"baz, foo, bar"

Of course, this is not what you are asking for.

The display of the tags themselves is defined 
here: $:/core/ui/ViewTemplate/tags, which contains:
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" 
retain="yes" animate="yes">
<div class="tc-tags-wrapper"><$list 
filter="[all[current]tags[]sort[title]]" template="$:/core/ui/TagTemplate" 
storyview="pop"/></div>
</$reveal>

As you can see, the $list filter definition used here includes 
"sort[title]".  Thus, the names of the tags are always sorted 
alphabetically.

To apply a custom sort order to the tag names, you will need to modify 
$:/core/ui/ViewTemplate/tags, like this:
<$reveal type="nomatch" stateTitle=<<folded-state>> text="hide" tag="div" 
retain="yes" animate="yes">
<div class="tc-tags-wrapper">
   <$list filter="[all[current]tags[]] +[enlist{MyTagOrder}]" 
template="$:/core/ui/TagTemplate" storyview="pop"/>
   <$list filter="[all[current]tags[]] -[enlist{MyTagOrder}] 
+[sort[title]]" template="$:/core/ui/TagTemplate" storyview="pop"/>
</div>
</$reveal>

Then, define a tiddler named "MyTagOrder", containing the names of the tags 
you want to have listed in a specific order.

For example, suppose you tag a tiddler with the following tags:
foo bar baz A B C
Then, using the standard tag display code, the tags would appear, sorted by 
title, as:
A B bar baz C foo

and, if you define MyTagOrder containing:
foo bar
then, using the modified tag display code, the tags would appear this would 
appear as:
foo bar A B baz C

Q.E.D.

enjoy,
-e
Eric Shulman
TiddlyTools: "Small Tools for Big Ideas!" (tm) http://tiddlytools.github.io/
InsideTiddlyWiki: The Missing 
Manuals http://insidetiddlywiki.tiddlyspot.com/

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f7bbc568-5c8d-4e11-97b4-65af47e00881%40googlegroups.com.

Reply via email to