Merging tags - Tag Synonyms

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!)


Incidentally (digging deep into my memory cells here) Drupal has a synonyms module that you might look at for inspiration/ideas. As with many things Drupal it is too complex but the example screenshot is interesting - note how it makes it obvious at selection when the term you typed in is a synonym of another term. It might be jarring to folks to look for “pots” and come to a page of planters topics. Displaying the results as Planters (pots) might help address this.

The drupal module also has the ability, it appears, to determine whether a synonym can be selected when adding terms to content. That might be interesting. I often run into issues where people create tags that are similar to other tags - I wouldn’t mind if those showed up in results and sent people to the right tags page, but I am not sure I want people to be choosing to use the similar but wrong tag.

Another issue I run into frequently is with delimiting characters in tags, e.g. srilanka and sri-lanka and sri_lanka. All three are the same but do I want people to be able to add sri-lanka when the preferred tag is always srilanka? Because both are possible, unfortunately, we are constantly gardening and renaming tags.


Completely understand the rationale here, I guess my concern here was that “adding a synonym” feels light and undo-able …

In my use case on dev I amended 100 topics and junked a #howto tag replacing it with #knowledge-base the thing just happened right away and if I messed up there is no easy way to recover. I didn’t just create a synonym that is easy to remove, I changed the internal data on a 100 topics.


I added a modal with a warning about what will happen when adding synonyms.


2 posts were split to a new topic: Adding a tag synonym breaks when both already exist on a topic