How do I rearrange the order of tags in a tiddler?

Hello!

I have an amateurish level of understanding of TiddlyWiki. I’m using it to record the most up-to-date information for a roleplaying campaign I’m running with two other friends. So I set up a wiki on Tiddlyhost and password-protected it for base protection.

Is there a way to rearrange the order tags appear under a tiddler? I want to make it so a tag like “faction” is at the very start of the tag list, like in the first image, but not the second.

I censored some tag names as they are the usernames of my players.

I tried consulting this page but I earnestly cannot make heads or tails what the hell is a “tag tiddler.” Is it referring to the tag manager? The tiddler with the tags I want to rearrange? Please help!

2 Likes

One way may be to remove and add the tag to cause this to be reordered.

In many ways the order of tags on a tiddler is by definition irrelevant, it is that they are present on a tiddler that is most important. As a result the order is left as is.

This is solvable of course but if you want it to be automatic needs modification of core tiddler functionality. If you want to automate the order please share “Why you want to do so” and how the order would apply to all tiddlers? What in fact is the order you want?

Manual reordering;

  • The tags field is just a list of titles so you can reorder that list using the list-links-draggable in a tiddler tagged $:/tags/ViewTemplate .

<$macrocall $name=list-links-draggable tiddler=<<currentTiddler>> field="tags"/>

  • Use macrocall to parse parameters like current tiddler
  • The macro needs the tiddler parameter

Hey, first post? Welcome to TiddlerHood !

I’ve attached a json file which you’ll find at the bottom of this post.

Download the file, and drag/drop it into tiddlywiki.com to import the one tiddler and see what it does.

The “Alternative Tags List for View Template” tiddler is tagged with “$:/tags/ViewTemplate”, indicating that the content of this tiddler should be displayed as part of the view for all tiddlers.

“Alternative Tags List for View Template” has a “list-after” field, (it could also/alternatively have a “list-before” field) which tells TiddlyWiki where in the order of things it ought to appear. To compare the standard tags list with this alternative, the alternative is showing right after the standard TiddlyWiki tags list.

As you tweak “Alternative Tags List for View Template”, you can compare it with the standard. (All I’ve done is copy the content from “$:/core/ui/ViewTemplate/tags” and reversed the sort order, and added an orange border around it.)

If you are up to it, play around with this a little bit, and please ask questions. There is some foundational powerful stuff going on here.

As soon as you feel comfortable with what’s going on, the next step is getting your tags looking exactly as you would like (whatever way you would like.)

Then we can talk about hiding the standard layout of tags.

Alternative Tags List for View Template.json (501 Bytes)

I am trying to specify the order of tags for a set of tiddlers.


How can I specify the order of tags like the image above?

I get idea from here: https://groups.google.com/g/tiddlywiki/c/TLlPOrGvoCs/m/fbCAX4S3BgAJ

I edit the $:/core/ui/ViewTemplate/tags shadow tiddler and change this line to this:

<div class="tc-tags-wrapper"><$list filter="[all[current]tags[]sort[title]sort[color]sortby{$:/config/TagsOrder}]" template="$:/core/ui/TagTemplate" storyview="pop"/></div>

So tags are ordering by title, color, then defined order in $:/config/TagsOrder

This is an example in my personal TW. Just need to carefully pick color for a group of tiddler.

Thank you! That worked wonderfully. I had tried the TagsOrder tiddler as mentioned above, but didn’t have the “tags” shadow tiddler formatted correctly.

I attached my $:/config/TagsOrder which might be useful for you.

$__config_TagsOrder.json (270 Bytes)

1 Like