How to create tag structures, tag category restrictions, tag groups and tag relationships

Now that tag support is a core feature of Discourse instead of being a separate plugin, we’ve added some new features around tagging. In this How-To I’ll go through setting up a tag schema like Car Talk uses.

We’ll want to achieve these things:

  • Tags for car makes and car models.
  • Only allow the car make and model tags to be used in certain categories.
  • Car model tags can only be chosen if the matching car make tag is used.

1. Pre-reqs

First, we need to enable tags in the settings:

In a schema where we’re strict about how tags are used, we should prevent most people from creating new tags:

2. Tag Groups

Go to the tags index page (/tags). Choose “Manage Tag Groups” from the top right menu.

tag3

Top-level tags

First let’s create the car make tags, which we want people to enter first.

On the tag group page:

  1. Create a new group.
  2. Give it a title.
  3. Add the tags that should belong in the group. You can add existing tags, or create new ones from this page.
  4. We only want people to use one car make tag per topic, so check the box to add this limitation.
  5. Save the group.

Parent-child tag relationships

Now we’ll define the car model tags, which are grouped according to the car makes. There will be one group for each car make.

Create another group as before with an appropriate name. This time we add a parent tag. In this example, we define the Honda car models group, and use honda as the parent tag.

The result

At this point, tagging a topic will obey these rules. When trying to add tags, the first tag can only be one of the car makes (or other tags that have no limitations on where they can be used).

The second tag can be one of the model tags matching the chosen make tag.

Visibility and usage restrictions

If needed, you can restrict the visibility or application permissions of tags to specific user groups:

3. Category restrictions

If I only want car discussions to happen in a certain category, I can restrict the use of all the car make and model tags from the category settings.

In the “Tags” tab of a category’s settings, add the groups.

If I have other categories where these tags should also be permitted, they can be added in those categories’ settings in the same way.

And that’s it!

Additional Resources

A comprehensive guide to Discourse tags
Questions about creating, uploading, editing tags
Educating users about tags


Last Reviewed by @AlexDev on 2022-05-24T22:00:00Z

65 Likes

Hi Neil, can I find this restriction setting now? Just can’t find it on my page…

Hi @Sherran :slightly_smiling_face:

What page are you looking on? It should be easy to spot from the Tags tab in the category settings.

Wanna set tags restriction for certain categories. My tag tab look like this:

Only to upload tags and create groups.

If you go to the category you want to add the restricted tags to, and open up the category admin wrench, you should see the Tag tab in there. That’s the screen you want. :+1:

2 Likes

You are right. There it is!

1 Like