# Set order of tags on topics/messages and in lists

**URL:** <https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535>\
**Category:** Feature\
**Created:** [March 22, 2018, 4:43am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535 "2018-03-22T04:43:30Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [March 22, 2018, 4:43am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/1 "2018-03-22T04:43:30Z")

</div>

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](https://meta.discourse.org/t/using-discourse-as-ticket-system-so-no-balls-are-dropped-woman-juggling/82698). 🤹‍♀️

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](https://community.namati.org/tags) 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:

 ![30%20PM](https://global.discourse-cdn.com/meta/original/3X/9/2/92fb9ec5fa348db871a6e46fc8d7b04431e46940.png)

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

 ![58%20PM](https://global.discourse-cdn.com/meta/original/3X/6/a/6a265cea81fbc994dafb0af0c7ba6551dddc8b52.png)

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [March 22, 2018, 4:46am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/2 "2018-03-22T04:46:57Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [March 22, 2018, 4:47am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/3 "2018-03-22T04:47:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [March 22, 2018, 4:52am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/4 "2018-03-22T04:52:20Z")

</div>

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: [https://meta.stackoverflow.com/](https://meta.stackoverflow.com/)

 ![image](https://global.discourse-cdn.com/meta/original/3X/9/0/908866523040df6133b4dec93d9b01a504ac384e.png)

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

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [March 22, 2018, 4:53am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/5 "2018-03-22T04:53:38Z")

</div>

> [@sam](#):
>
> 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?

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

> [@Show tags in alphabetical order - not working](https://meta.discourse.org/t/show-tags-in-alphabetical-order-not-working/43860):
>
> There is a setting in the ACP that says Show tags in alphabetical order. Default is to show in order of popularity but changing it has no effect on the /tags page - they are always shown by popularity by default (we want them to default to alphabetically). Is this a bug or is this a setting for something else confused

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.

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [March 22, 2018, 4:54am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/6 "2018-03-22T04:54:35Z")

</div>

> [@tobiaseigen](#):
>
> but in these places they are listed in order of popularity.

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

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [March 22, 2018, 4:56am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/7 "2018-03-22T04:56:10Z")

</div>

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.

 ![15%20PM](https://global.discourse-cdn.com/meta/original/3X/8/7/87c54f70fd4593d7103c9a7afe8f5312666ae3fb.png)

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [March 22, 2018, 4:57am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/8 "2018-03-22T04:57:49Z")

</div>

> [@tobiaseigen](#):
>
> I am expecting tags to be listed in alphabetical order everywhere

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.

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [March 22, 2018, 5:01am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/9 "2018-03-22T05:01:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [March 22, 2018, 9:29am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/11 "2018-03-22T09:29:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [March 22, 2018, 9:57am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/12 "2018-03-22T09:57:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [March 22, 2018, 10:45am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/13 "2018-03-22T10:45:32Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [March 22, 2018, 10:51am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/14 "2018-03-22T10:51:12Z")

</div>

> [@codinghorror](#):
>
> the default, most frequently used tags on the left

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”

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [March 22, 2018, 11:03am UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/15 "2018-03-22T11:03:32Z")

</div>

> [@sam](#):
>
> I prefer the default to be cheapest, which is “order you entered tags in the UI”

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?

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [March 22, 2018, 6:51pm UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/16 "2018-03-22T18:51:37Z")

</div>

Thanks, both!

> [@codinghorror](#):
>
> 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?

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.

> [@(Superseded) Add a custom fontawesome icon and color to your tag](https://meta.discourse.org/t/add-a-custom-fontawesome-icon-to-your-tag/67881):
>
> information_source The easiest way to do this is to use the new theme component: [Tag Icons](https://meta.discourse.org/t/tag-icons-component/109757) UPDATE: These instructions have been updated since SVG images are now used on Discourse rather than Font Awesome icons. I’ve styled my tags with colours and SVG images: SVG icon images can be freely downloaded from sites such as [https://thenounproject.com/](https://thenounproject.com/) Example CSS (thanks @pmusaraj for the below): @import "common/foundation/mixins"; [data-tag-name="tag1"]:link, [data-tag-name="tag1"]:…

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [March 22, 2018, 9:56pm UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/17 "2018-03-22T21:56:23Z")

</div>

> [@codinghorror](#):
>
> but why can’t we tweak at save time to get the order we desire? Which is either tag frequency, or alpha?

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

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [March 22, 2018, 10:19pm UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/18 "2018-03-22T22:19:43Z")

</div>

> [@sam](#):
>
> We can do this at save but frequency changes as time goes by and then people may complain

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.

---

<div class="post-metadata">

**Author:** ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)\
**Post date:** [March 22, 2018, 11:15pm UTC](https://meta.discourse.org/t/set-order-of-tags-on-topics-messages-and-in-lists/83535/19 "2018-03-22T23:15:53Z")

</div>

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.

 ![55%20PM](https://global.discourse-cdn.com/meta/original/3X/2/0/2074331589f618f718b57190eed9e0200d16af18.png)

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.

 ![41%20PM](https://global.discourse-cdn.com/meta/original/3X/9/9/99d50006f6b99fbafba71e453b8fbbe685146adb.png)
