Merging tags - Tag Synonyms

There are two ways to say the same thing as Bangalore city also known as Bengaluru.

As this topics has both tags.

Are there any ways I can merge these tags and can have the main tag and others as synonyms as mentioned in the following article?

Does discourse provide it?


I do not believe so at the moment - each tag is unique.

A not very beautiful workaround you could do is enforce one spelling/synonym by making the others staff-tags (so most users can’t use them). You can then either not use the different spellings /synonyms at all or just have one topic for each which is just a post redirecting to the other tag.


At some point we will be forced to implement tag synonyms @neil it is inevitable. Also a problem with plurals. We went through this same thing at Stack Overflow…


@codinghorror Any guidance on if this is upcoming soon or still a ways out? Thinking through how to overhaul tagging as we’re migrating from Vanilla and deciding whether to build our own internal systems for tag synonyms and merging (likely a manual process) or wait until it’s supported natively.

If you’re getting close, perhaps we’ll hold off. :slight_smile: Thanks!


I wouldn’t mind doing it, not sure how much work it would be though. Any idea on scope @neil? The classic example from my SO days is this one:

string vs. strings

Just making plurals remap to the singular version is a good starting point, though obviously you’d want {x} different forms to remap to the same base.


Thanks for the reply, @codinghorror! Automatic merging of singular vs. plural would be great.

One more thing that might be useful based on my experience is a new tags queue so it’s easy so spot them and either a) approve them as is b) merge them with something else or c) delete them.

One of the problems we have now is identifying newly added tags. Because they’re not anywhere unique it becomes a hunting game of pouring through a sea of words each month looking for similar words/phrases.

Having a new tag queue - or being able to sort tags by date added - would be immensely helpful for keeping things nicely organized. Or, at least selfishly, for us. :slight_smile:


We don’t have much of a UI for managing tags, since we only allow renaming and deleting currently. But merging and adding a list of synonyms doesn’t seem like much. Reviewing new tags would happen in the new review queue, so I’m not sure how much work that would be. So… a week or two of work?


I’ll add it to the 2.4 release list.


Fantastic, thanks @codinghorror and @neil!


Here’s a preview of what I’ve got so far.

I’d like to add a bit more to the tag info section, like which categories it’s restricted to (if any), and which tag groups it belongs to (if “tags listed by group” setting is enabled).

Adding tag descriptions has been requested, so this info section will be where it will be seen and changed.


This is cool! Should the button be :wrench: Edit like it is for categories? and then should the settings also be in a modal?


The video is showing the admin view of the tag info, but it also works for anon and non-staff users. They will see the synonyms, categories where the tags can be used (if they’re restricted to some categories), and tag group names that they belong to (if tag group names are public on the /tags page).

That space is also ready for new features that have been requested, like being able to have descriptions for tags.

I kinda hate the modal approach now, especially since the category modal is so full and keeps growing. Maybe category settings need to be moved out of a modal.


Yeah that makes sense, I definitely prefer on-page to modal but I’d rather be consistent either way. Updating the category settings to be more like the layout for group settings might be a good move at some point.


This feature made it into the latest beta release, so please upgrade and give it a try.

Creating synonyms and merging tags is done in the same place. If you wanted to merge the “js” and “javascript” tags, and choose “javascript” as the base tag, then go to the javascript tag’s page (/tags/javascript).

Once “js” is added as a synonym, its topics will show as tagged with “javascript”.

In search and filters, js will show up and direct people to javascript instead. Tagging topics will js will use javascript instead. And so on. I hope I caught all the places where synonyms need to be handled, so let me know if I missed anything.


This is beautiful work <3

Edit: i just noticed that it’s a very smooth way to rename a tag too. We have over 100 ‘ux’ tags, but the forum settings want tags with 3 or more letters. I added ‘ux’ as a synonym of ‘ux-design’ and all our ‘ux’ tags were instantly updated.


I was kind of surprised by the rename behavior, it was a great surprise but still a surprise. Maybe if synonyms are going to cause a mass rename we should prompt @neil you are about to amend 100 topics with the tag foo to the tag bar something like that? Not sure, it was a bit or a surprise.


Hmm I don’t understand the surprise here. Would you ever want to have it both ways?

Using that example, what’s the use case for having some topics tagged as js and others tagged as javascript, after js has been merged into javascript? I guess a message explaining what a synonym means would be helpful.


I am absolutely :heart:ing tag synonyms and this new UI for managing them - nice job!

I think the surprise Sam is referring to that I also am feeling is that this is a blunt tool that has the potential to affect many topics. It’s certainly a Good Thing™ and a vast improvement, but because it can’t be reversed (there is no undo, right?) it might cause people to accidentally make changes they later regret, without realizing it. It may be overkill, but having a prompt to warn about the extent of the change that’s about to happen would help.


I don’t even use tags but this looks awesome! Re: potential surprise, just being clear about adding synonym = actual merging would probably help.

To me ‘synonym’ could imply that all versions will still show but just map to the same thing under the hood; I could prob think of a case where someone might actually want the canonical version of a tag to be some longer more formal thing, but still expect to have the shorter synonym version(s) show for display purposes, or something like that (though I understand why the behavior as you have it makes more sense!)