How to use aliases for tags?

Hello!

Well, first of all: Thanks for this wonderful app and the supportive community. Really impressive and a delight to know that such a ‘place’ exists in the internet. Here’s my question though:

After searching all the ressources available to me, I still don’t get it… how can I use aliases for tags?

A concrete example → I use #learning and I use the German equivalent #lernen. Now, how do I succeed with Obsidian presenting me the search results to both of them – every time I search for one of them? I really don’t get it. Aliases seem to work for pages/notes but not for tags.

As a social anthropologist, I would be extremely thankful if I could use the same functionality also for my tags:

  • I often work with 3 to 4 languages simultaniously. It would be awesome to just use my primary language, to be able to relax and forget about all the other instances where I used the same tag in another language.
  • Also, it would heavily declutter my UI :slight_smile: (and allow me for a better organisation of my tags)
  • And finally, it would just be super-yummy, if aliases to a certain tag would be proposed by the program everytime I, for instance, type in #learning.

Thanks! And kind regards,
Chinchivi

1 Like

how do I succeed with Obsidian presenting me the search results to both of them

You can use “tag:onetag OR tag:secondtag” in search tab.

As for your question, obsidian doesn’t support tag aliases Tag aliases .
One way to make your situation less painful is using nested tag.
I would make #lernen a nested tag for #learning like this: #learning/lernen. And when you will enter #lernen autocomplete feature will suggest #learning/lernen option.
Also when you will search #learning it would be search for #learning/lernen too.

1 Like

Hello @Chinchivi. Good question!

You could as a workaround create a few macros that type in the various versions of your common tags with just a hotkey press, saving you time and effort. I only have any experience with AutoHotkey but I hear Keyboard Maestro is good too. Or if you don’t mind adding the various versions each time, that may work. It wouldn’t be horribly difficult with the quality auto suggestions.

Or you could, for example, have a consistent spacing convention for tags all in sequence, such as 2 spaces before and after tags that are part of a group of versions of that tag with a - as a fence. And when adding tags that aren’t part of a group you could, for example, have 4 spaces before and after each tag also using the - fence. Then you could do a mass search and replace quickly identifying and replacing the proper tags which haven’t been added in a set with the proper set following the convention. This process could be somewhat automated with macros as well.

Sorry if this is only further confusing you as this is definitely not how Obsidian recommends doing things, not have I actually used this myself. I am just throwing the idea out there. The mass search and replace available within other programs like VSCode on Windows is definitely helpful for this type of thing. There are probably other more elegant creative solutions following this strategy to avoid replacing tags and causing duplicates using regex, but I am not sure what the code would be. Also wouldn’t be the end of the world if you accidentally had a duplicate once in a while.

Anyways, Good luck. I definitely agree with you about the community here. What a great place!

1 Like

I reply to both answers at the same time: Thank you very much for your reply @Ellanxis & @I-d-as! I am now following the thread in the forum you (@Ellanxis) mentioned :slight_smile:

Using nested tags sounds like a doable and easy approach. I currently use them in the manner of #writing, #writing/academic → Thus indicating that the latter one marks instances of acedemic writing, a ‘sub-type’ of the category of ‘writing’.

However, I think I can restructure and tweak my use of tags a little bit… as an idea, your approach seems legit. Especially since in this way, I can easily search for the ‘aliases/nested tags’. I need to test it out.

@Ellanxis & @I-d-as : I will think about an approach to the problem, try out your ideas and then report back. I am not familiar with the use of makros nor with regex or basically everything involving even the easiest coding. But as I – since using Obsidian – repeatedly see/read about what is possible with such things, it is definetly something to check out :slight_smile: The use of a consistent spacing convention is another good idea. I’ll try it out too… The ability to mass search and replace tags at a later time is not what I was thinking about – being more concerned with solution that work ad hoc, at the moment I want to use the tags –, but it is definetly worth keeping in mind! (As it is definetly better to have structered your notes in a way that mass search and replace possible beforehand.)

Thank you very much!

1 Like

I am writing in two languages all the time and the problem of tags was bothering me. I switched from tags to backlinks to a note, where I can have any amount of aliases I want, so instead of doing black magic with (for example) #tag I do [[tag]] and then in the “tag” note I have YAML:


aliases:

  • tag
  • тэг
  • тег
  • теги

2 Likes

Thank you, @dmdoka – after a somewhat sleepless night, I decided to use the approach you’ve suggested. (I will however, just for the sake of it, also further look into @I-d-as ideas of mass searching and replacing. There is much to learn! :slight_smile: ) Your approach has the unforeseen benefit, that I now have a page/note called ‘tag’ (using your example). So, whenever I want to write about the topic ‘tag’, I can just do it in that note. Before, I would have created a new note, titled it ‘tag’ and then searched for references and inserted them manually.
Additionally, though I lose the tag editor’s visual overview, it gives me space to now use tags in other ways… already thinking of possible avenues… Well, thank you all for your help!

1 Like

The fun part is that you are one step before the MOC (map of content) concept with this approach. The same note can be used not only as an aggregator of all backlinks and plan of the content, but also as a map of #tags - nothing holds you from adding the tag to the anchor notes to add context.
My logic changed when I started to use such an approach - the tags are the context (say language, country, historical period) something that I don’t have necessary in the text, and the anchor backlink is something that connects the current research.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.