I hope it's simple: How to make a "tag" twin

I am optimistic and still believe it is easy to create. (at least in theory)
Unfortunately I’ve been trying it myself for days but I would need your input.


I’ll explain better what I would like to do:

Lately I’m working on the editor, templates, hidden fields, buttons etc. In short, every change to the editor I felt could optimize my workflow.
And I was thinking it would be very handy to have a second field that behaves (almost) exactly like tags.
Basically I don’t want to be always forced to use field tags because otherwise I would be forced to have too many tags for each tiddler, thus defeating the beauty and simplicity of the tag mechanism.


For convenience, I will call this field tags2
I would like this field tags2 to have these features that tags has:

  • When adding a tag to a tiddler, its tags field is updated, but so is the tagging tiddler list field.
    If I add the Dog tag to the Borzoi tiddler, in the Borzoi tags field I wrote “Dog” and in the Dog list field “Borzoi” appears (not automatically, but I just need this to happen later maybe with a drag and drop in the pill)

  • Tag pills: The ability to manipulate the field list of the “Dog” tiddler with a drag and drop.

I don’t care what is built around the tags field. Only these basic functionality of tags.
For example I don’t care about a mechanism similar to $:/core/ui/TiddlerInfo/Tagging. Like a $:/core/ui/TiddlerInfo/Tagging2 would be complicated and not very useful, because I would like to use this new field tags2 for other purposes. The field tags does its job very well.

I think it shouldn’t be too difficult. My plan is this:

  • I clone these tiddlers
    $:/core/macros/tag-picker
    $:/core/macros/tag
    And I replace every reference to the “tags” field with “tags2”. I think (or rather I hope :sweat_smile:) that the basic idea should work and it’s simple, but I need some directions because I’m not so sure.

P.S.
I don’t know if I explained myself well. In case something is not clear, please tell me.

I’ve often thought that having two sets of tags is a good idea. One for meta information (e.g. Personal, Pets) and one for structural (i.e. tags that form a TOC).

Something similar has been implemented at least once. Here’s Jeds:

Generic Tag Fields

and a similar project

Make any field behave like tags

A different approach is to use a different field to create TOCs:

tocP

I found these by using search term “tag” at https://links.tiddlywiki.org/ . There may be other solutions there, so you might want to do some more exploring.

2 Likes

I don’t have time now to study them well, but it could already be the solution to my problem
Thank you!

By the way, this site is really nice, I didn’t know it. Thank you two times

@Matteo plugins such as the Generic Tags plugin are great package solutions, to your request. However there are multiple ways to go.

This question has come about many times in different ways because we have the tendency to overload the existing tags field. We have refered to this in many discussions as “poluting the tag space”. I would however suggest simply having an additional tags field not nessasary the best approach.

  • More value can be gained by thinking more about the meaning or function of a tag and posibly implementing it in a different way. For example rather than multiple status tags, use a status field with multiple values, one at a time.
  • Try the TocP Plugin for heirachies

Here are a few tips arrising from such conversations that come to mind. Som of which you are already on to;

  • It’s is often better to move a class of tags into a field/value pair to reduce the number of tags in use.
    • You can have one field one value
    • Or use a list field, one field, multiple values
  • Look at the tag-picker Macro this already allows you select from or create tags in an alternative field <<tag-picker tagField:"related">>
  • Look inside $:/core/macros/tag
    for some clues;
    • <<tag tagname>> will treat a tiddler as a tag pill even if it is not yet a tag
    • These macros could be cloned and renamed to use another field
    • You can make use of $:/core/ui/TagTemplate with lists, or current tiddler, {{||$:/core/ui/TagTemplate}}
  • The Checkbox widgets list CheckboxWidget (listField Mode) is another way to quickly influence or toggle the tags or an alternative tags field.

I and others have a range of solutions already out there, so perhaps let us know about the nature of some tags you would move into an alt tags field, how are they intended to work, and we may already have out of the box (JSON) solutions.

  • In the upcoming TW 5.3.x it will be easy to define your own filter operators to replicate the existing tags operators, but acting on a second tag like field
1 Like

While the projects that @Mark_S reference are what also first came to my mind, after reading the following I’m not sure that is what you’re looking for:

It seems you want to add extra actions to the tag-picker Macro invocation. That macro does have an actions parameter so I think (but not sure) that it would be possible to define a macro that you add as the parameter value.

That is actually what happens when you click a pill (in view mode) to see its list, and then drag’n drop to reorder those titles. This modifies the list field of the tag tiddler.

If you, after all, do look for something like Gentags, then that revolves around a concept generally referred to as “typed tags” (at least I think it is called so), i.e the idea to have different categories of tags. We can almost do this in TW; tags can, in turn, be tagged to make up “categories”. And there are now a few tools to manipulate individual items in a field rather than the full field. And any field can easily be made to show in various places in the tiddler, and items in a field can be styled like tag pills. A main difference from real tags and the tags field, is that the TW system is optimized for those.

Hi @Matteo
Using another field like tags is implemented in two kookma plugins:

  • Solution
  • Mehregan (Thinkup plugin)

In both of them keywords field acts like tags field! There is one caveat ! TiddlyWiki is highly optimized for using tags, so a clone field probably will not have the same performance as tags!

The idea was to have Category and Tags.

What a pity I don’t have much time these days as there are many things to think about here.
Thank you all.

Thanks, they could be very useful

Basically they should work like the tags field in the sense that tiddlers with that tag end up in a list. And that list is reorderable by a drag and drop from its tag-pill.

I have some applications in mind for a second tag field.
Some are still immature so I’ll explain what I would like to do first:

  • A second field that acts like tags that i will name something like “trail” or “footpath”:

Which is to enable a previous tiddler / next tiddler-like functionality that I’ve seen used before. But with (I think) greater versatility and convenience.
Basically I plan to create a section dedicated to “trails” in the tiddler editor that exactly how tags are added allows me to add “trails” to the tiddler.

A tiddler that has somthing in its trail field could be thinked as a stop, a stage in the trail. If the tiddler “borzoi” has in its trail field “dog” and “hunting dog”

An example: you are in the tiddler “Pug”, at the bottom of this tiddler you can follow a list of tiddlers, following the “dog” trail, and scrolling through the list of dogs you will meet the “borzoi” tiddler. In this tiddler you can continue to follow the “dog” trail or you can switch paths using a dropdown and follow the “hunting dog” trail.

In addition, if you want to sort the order of the tiddlers that are steps in the trail “dogs” in a different way (for example by size, or alphabetically, you will already have a handy tag-pill within which you can easily reorder them)


Now I don’t have time to explain more about the other features or how I’m going to create this system. But I hope you get the idea.
If I can make it though I’m going to make a plugin out of it, and I will share it here.

Image (To better visualize what I have explained (not very well) Masterfully made on paint)

Then I have other ideas with this second tags field, but they are more immature, still hazy.



No, I probably just explained badly what I wanted to achieve.
There I just wanted to describe what functionalities (already in place) that are built around the tags field I really care about.

You should probably take a look at the WizardNav plugin. by @Scott_Sauyet, which seems to be addressing a similar need, but with different mechanics:

https://crosseye.github.io/TW5-WizardNav/

Even if the problem that you are forced to use tags remains, it is very interesting, it will save me some work later. I’m glad someone has already thought of something so similar. Thanks for bringing it to my attention @Springer :grinning_face_with_smiling_eyes:

If this field represented membership of a named trail, you may only ever use one of these “tags”, and use the list representation to find its position there in.

  • If so it may be reasonable just to use a single tag

Not withstanding the other complexities, in future one answer may be in something I have started to develop called a field-pill, in contrast to a tag-pill.