Restrict tags to specific categories

Would it be possible to restrict tags to specific categories?

This would be applicable where a tag list is only relevant in certain categories.

For implementation I’m imagining an ‘allow tags in category’ flag in category settings.

7 Likes

This could come in useful.

For example, we have HTML & CSS, JavaScript and PHP categories.

There is a javascript Tag, the intended use is for “cross-over” topics.
eg. PHP code that outputs JavaScript could be in the PHP category and tagged javascript.

What often happens is a member will post a topic in the JavaScript category, and also give it the javascript tag.

Not that doing so is horribly wrong. but it does lessen the efficiency of searching for topics via the javascript tag when searching via the JavaScript category would more than suffice.

4 Likes

… and some long-suffering moderator futilely tries to keep the place tidy by removing them again, as far as possible. :wink:

I’d also be very happy to see this feature added.

4 Likes

Yeah this is on my list too. The composer might get a bit weird. Choose category, enter tags, change the category, … tags that aren’t allowed get removed automatically?

4 Likes

That sounds hairy.

Maybe better to aviod the composer filtering and allow the tag on “create” but remove it “after” somehow?

Though that could cause some “my tag didn’t work” pain.

I’m starting work on this now. Here’s a picture.

(Note that something else in the pipeline is Tag Grouping, so all those car maker tags would naturally belong to a single tag group called “Makes” and can be added en masse. But forget that for now.)

That picture can be interpreted differently:

  1. These tags can be used only in this category, and others that explicitly allow them.
  2. The tags can be used in any category, but this category only allows these tags.
  3. (other cases?)

@Mittineague’s example is a case where the javascript tag should be allowed everywhere except for one category. So maybe a “forbidden tags” input is needed too.

Thoughts?

7 Likes

I think your case (1) would be the most common scenario.

Good stuff @neil!

1 Like

I agree with 1 - if the category doesn’t state which tags then all can be used. If it does state which tags then only they can be used.

In place of all tags being allowed I think also having a list of tags which cannot be used would also be useful - I know you could probably get around this by stating all tags as above however if you have quite a few tags to manage I think having this forbidden tag would be more user friendly.

1 Like

Awesome work! Can we get an ETA on this?

I am concerned about #1. On a site with lots of categories, restricting a tag from one category would require editing every other category on the site to add the tag as allowed. I think forbidden tags are also required.

An alternative option would be to have a check-box that says “allow all tags” which is defaulted to on. Then, you can add the restricted tag to one category, and uncheck the box on the category you wish to restrict. The rest would remail checked, and thus continue to work. However, I feel this is far more complicated then a “forbidden tag” box.


Another thought, it would be nice to have a “all” and “none” special option. For example, if I want to disable tagging in a category, it could be tough to do so due to tags being dynamic. Or, if a large number of categories restrict certain tags, but I want a single category to allow all, it would be nice not to type every possible tag.


Finally, how will this effect staff users? Would it be like a closed topic, and have no effect?

2 Likes

@jomaxro Yes. :stuck_out_tongue:

Those permutations are going through my head too. I’ve already scratched down some notes about checkboxes we might need in addition to a list of tags.

The main use case I’m hearing is when a set of tags should only be used in one or two categories. So some checkboxes to clarify that behaviour:

  • Allow other tags in this category too
  • Don’t allow these tags anywhere else

It’s possible that these options don’t belong in the category settings, but in the Tag Group settings.

Tag Group settings:

  • A set of tags
  • (optional) A set of categories where they can be used
  • (optional) A set of categories where they can’t be used

Any tag that’s not in a group can be used anywhere.

So maybe I need to build tag grouping first.

5 Likes

Tag groups - where will the setting for this be? I am concerned if this is stored as a site setting, mods won’t get access…

No it wouldn’t be in site settings. The concept does add more complexity that many wouldn’t need, so I should stick with my original plan of using it as a convenience for bulk management of tags.

3 Likes

[quote=“neil, post:13, topic:44026”]
so I should stick with my original plan of using it as a convenience for bulk management of tags.
[/quote]

Now I’m confused…are you saying no tag groups?

Edit: Nevermind, re-read your last 3 posts, and now I think I am all clear on things.


Looking back at your checkboxes, the first check box makes perfect sense: if I put pigs into the box, do I want users to be allowed to use dogs and cats tags as well. The second makes me concerned: what if I want pigs to be allowed in 2 categories only? Could Don't allow these tags anywhere else instead be Don't allow these tags anywhere else unless explicitely allowed. Also, let’s say I want to allow the pigs and pork tags in a category, and prevent the use of only pork elsewhere. Is it possible to do so, as it would seem the second check box applies to all tags entered, with no way to differentiate.

Oh my, so many possible permutations!

1 Like

Yeah it’s a lot of possible requirements. Ultimately if someone has too many categories and too many tags and wants to micromanage them, I’m not sure we can make their life easy.

3 Likes

A thought. Instead of a single box where tags can be inputed, and “global” checkboxes that apply to all tags entered, could there instead be a “advanced tag” button (name unimportant), that has a field for the tag to be entered, and the 2 check boxes you mentioned above. Once you enter a tag (or tag group), another line with a box and 2 check boxes appears. This would allow for more micro-management of tags without overwhelming anyone…

I completed a first pass of this. It doesn’t include any of the extra options yet. As pictured above, the category modal lets you restrict tags to the category.

To show the category-tag relationships, the tag index page will show them as grouped. Also, tag inputs will show results based on which category is selected in the composer.

14 Likes

2 posts were split to a new topic: Enable tagging only in some categories

5 posts were split to a new topic: Limiting tags to specific categories