设置结构化标记,包含标签组和类别标签限制

Tag 支持是 Discourse 的一项核心功能。在本指南中,我将介绍如何设置一个像 Car Talk 使用的标签方案。

我们希望实现以下目标:

  • 为汽车品牌和汽车型号设置标签。
  • 只允许在特定分类中使用汽车品牌和型号标签。
  • 只有在使用匹配的汽车品牌标签时,才能选择汽车型号标签。

先决条件

默认情况下,Discourse 中启用了标签功能(通过 tagging_enabled 站点设置)。如果之前禁用过,请确保将其打开。

在一个严格控制标签使用方式的方案中,我们应该阻止大多数人创建新标签。create_tag_allowed_groups 设置控制哪些用户组可以创建新标签(默认为管理员、版主和信任等级 3)。您也可以使用 tag_topic_allowed_groups 设置来控制谁可以向主题应用标签。

标签组

转到标签组页面(/tag_groups)。

顶级标签

首先,我们创建汽车品牌标签,这是我们希望用户首先输入的标签。

在标签组页面上:

  1. 创建一个新组。

  2. 为其设置一个标题。

  3. 添加应属于该组的标签。您可以添加现有标签,或在此页面上创建新标签。

  4. 我们只希望用户每个主题使用一个汽车品牌标签,因此请勾选以添加此限制的复选框。

  5. 保存该组。

父子标签关系

现在我们将定义汽车型号标签,它们根据汽车品牌进行分组。每个汽车品牌将有一个组。

像以前一样创建一个新组,并使用适当的名称。这次我们添加一个父标签。在此示例中,我们定义本田汽车型号组,并使用 honda 作为父标签。

结果

此时,标记主题将遵循这些规则。尝试添加标签时,第一个标签只能是汽车品牌标签之一(或对使用位置没有限制的其他标签)。

第二个标签可以是与所选品牌标签匹配的型号标签之一。

可见性和使用限制

如果需要,您可以将标签的可见性或应用权限限制给特定的用户组:

分类限制

如果我只希望在特定分类中进行汽车讨论,可以从分类设置中限制所有汽车品牌和型号标签的使用。

在分类设置的“标签”选项卡中,您可以:

  • 将标签限制在此分类中 —— 添加应仅在此分类中可用的单个标签或标签组。
  • 允许全局标签 —— 可选地允许其他不受限制的标签与受限制的标签一起使用。
  • 要求标签组 —— 要求新主题包含来自特定标签组的最小数量的标签。

如果我希望在其他分类中也允许使用这些标签,可以在那些分类的设置中以相同的方式添加它们。

就这样!

附加资源

71 个赞
Using tags instead of subcategories for a car forum
(How) Can we increase the tags limit?
Categories with allowed Tag Groups
Tagging rights for specific users?
Tagging a topic from email in
Large number of forums / categories / groups?
Is it possible to make tags mandatory?
Topic Title Flair - or something like that?
Empower moderators to restrict tag groups | Nested tag structure | Navigation bar
How might we better structure #howto?
Educating users about tags
Several questions about management right
Kanban Board
Categories vs tags: is this even possible?
Help with Tags that can only be created by the Moderators but used by everyone
Using tags to categorize city specific questions
User-defined keyword for each thread
Best practices to manage events inside a category
Default tags for users
Default tag for new topics?
Structuring an active support community migrating from Facebook
How to Find Your Community's Most Commonly Asked Questions
Best element to use for pulling featured posts
Editing topics with tag groups from parents allows incorrect tagging
How can I make sure only admins/mods are able to create featured posts?
Is it possible to make tags mandatory?
Not Able To Post New Topic Using Tags - Error
Filter Tags on change Category
About topic tags
Uploading Tag for specific categories
Tag Group URLs
Getting certain posts to Zapier
I Need a category link to take me to a tags page
Staff tags missing in settings?
Feedback on my forum
Anchors to headings do not always work
How to create a help web page for my community site in two levels
Help with Tags that can only be created by the Moderators but used by everyone