Set order of tags on topics/messages and in lists

So… it’s possible to show tags in alphabetical order or order of popularity in /tags and in pulldowns, but I am not seeing the ability to show tags on topics or messages or lists in alphabetical order. The ordering seems to be fairly random but may be in order of popularity, which makes tags somewhat more cumbersome to use to turn messages and topics into tickets, so we don’t drop any balls. :woman_juggling:

Is it possible for you to make this respect the alphabetical ordering so the tags appear in an order that make sense? Or, preferably, to provide ordering based on tag groups?

On my site, I have tag groups used for tickets (to set priority and status, if ticket is present) and for wiki topics (to identify draft and type etc), and then generally for other tags eg. community. region/country, theme, language etc etc. It would be superb to be able to decide the order - e.g. to see e.g ticket, priority, status, then the other tags after that.

Here’s an example of how it looks now:


and the messages tags view showing the number of messages (or is it topics?) with each of the tags, that might explain the ordering:


Simplest change I could get behind would be a flag to always show tags in alphabetical order, @codinghorror should this be default on or off?

Er what? This request makes no sense to me. I’d just wait on this.

You could do something in a plugin here if you must, but I think the first step you want to take is some custom styling for special tags.

StackOverflow meta uses this scheme:

They also order so “bug” is always first in the list regardless of how people tagged it.


There seems to be no setting to show tags in these places in alphabetical order. Maybe it’s related to this:

I am expecting tags to be listed in alphabetical order everywhere, but in these places they are listed in order of popularity.

@codinghorror I’m ok with you guys waiting on this and letting it settle, as you figure out tags generally.

This does not sound right to me … I thought its just by order it was tagged in the create topic UI

I’ll check but I’ve been trying to be consistent the order I tag them…

update: here’s the result of my quick test. the ordering is in order of popularity.


1 Like

That was never the intent of the setting… the intent was to show them in alpha order in the selection pages only, when you are “picking” a tag from a giant list.

Yeah something is messed up and I can repro it on try.

Tag topic as: first, second, third

It shows up as first, second, third

Edit it to second, third, first , it keeps same original order.

My guess here is that we simply maintain the original order it was tagged which is not the right thing.

EDIT to correct ordering you have to first save with no tags, and then put the tags in again.


If we are not choosing any tag order on post display, we could possibly normalize it to respect the site setting. I agree having random order-originally-tagged is not correct cc @tobiaseigen


At a minimum we should fix the bug so users can edit tag ordering and what we display in the composer matches what they see in the topic list


Maybe; I’d prefer that tag order is either

  • in order of tag frequency (the default, most frequently used tags on the left)
  • in order of alphabet (if set in settings)
1 Like

Keep in mind, that adds one query to every “latest” page. Cause you need to harvest every tag and then do a query to get frequencies. It has a cost.

I prefer the default to be cheapest, which is “order you entered tags in the UI”

1 Like

OK that’s fair, but why can’t we tweak at save time to get the order we desire? Which is either tag frequency, or alpha?

Thanks, both!

This would be a fabulous start, or maybe even a perfectly good, straightforward solution if it’s possible.

However, if we’re going to use tagging as part of a support ticket system, it would be a big help to go a step further and enable admins to set the tag order in these places by tag group. So as we churn through tickets we don’t wear ourselves out looking for priority and status in different places. I also think this approach would make tags easier to use overall, for all sites using tag groups, so that certain especially useful tags people look for are always in the same spot in the list. I’d be happy to hear from others on what they think. Maybe I’m completely off base here.

Also, with other improvements hopefully underway with tags and messages, this may become less of an issue… e.g. the ability to easily filter messages by more than one tag at a time, as well as filtering topics by tags that are inside specific message inboxes.

As an easy step I can take myself, I agree styling special tags is a great idea to make it easier for our weary eyes to quickly identify which ticket to tackle next - I like that and have been meaning to try it out. In fact, I think it’s so cool I wish it were a feature baked into discourse, ‘tag flair’ akin to ‘avatar flair’ for groups.

1 Like

We can do this at save but frequency changes as time goes by and then people may complain. I think defaulting to “what you see in composer is what you get” is the simplest, cause its easiest to explain. I would prefer a 3 way drop down in the settings for as entered|by frequency|alphabetically but this is not a :mountain: I want to die on.

Having a sort order on tag groups makes sense to me, but does not feel like an urgent feature. @tobiaseigen I wonder if you should just put something up on #marketplace asking for a plugin that orders your tags … just … so. Technically, if there are not too many of them this can be achieved in a theme component without even needing a plugin (except that in mails it may be wrong order if a theme component is used)


Not really that often in the big scheme of things… and they could edit and re-save the post to “fix” that. And of course alpha order is never changing, unless we start adding new letters to the alphabet.

I think consistency with the existing site setting at time of save makes the most sense.

This is all well and good and I think I understand the direction you both are going with this - many thanks.

In terms of troubleshooting what is actually going on… I am still fairly confused. It looks like the order is different on the topic itself and in topic lists, and it seems fairly random to me still. See these two screenshots.

Here’s the latest view on frontpage. I seem to recall that I added the INDIA tag to this topic later later, so it makes sense that it is last in the list.

This is the topic itself - notice that INDIA has moved into the second position. This is fairly random seeming to me, since INDIA is used 25 times and POLLUTION only 4 times. WATER is used 3 times. ENVIRONMENT is a popular tag at 83 uses.


1 Like