标签横幅

:discourse2: Summary Tag Banners displays the tag name and description in a banner at the top of the page when visiting a tag-filtered topic list (similar to the Category Banners component)
:eyeglasses: Preview Preview on Discourse Theme Creator
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-tag-banners
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

Features

Developer Notes

You can customize these banners with CSS. Each banner gets the tag name(s) appended as a class, for example:

.tag-title-header.tag-banner-art {
  background: salmon;
  color: beige;
}

The banner also works with tag intersections (e.g., community.example.com/tags/intersection/art/new-tag)

In this case, you’d target .tag-banner-art.tag-banner-new-tag for CSS customization.

Settings

Name Description
show on mobile Show tag banners on mobile devices
show tag description Show tag description when available
show above site header Display the banner in the above site header connector.
show below site header Display the banner in the below site header connector.
show above main container Display the banner in the above main container connector, for sites with the sidebar enabled.
remove tag hyphen Remove hyphens from tag names in banners
remove tag underscore Remove underscores from tag names in banners
hide tag icon Hide the tag icon when used along with category banners
show with category banners Show full banner alongside category banners

:discourse2: Hosted by us? Theme components are available to use on our Pro, Business and Enterprise plans.

Last edited by @tobiaseigen 2025-06-24T03:17:47Z

Check documentPerform check on document:
41 个赞

帖子已拆分为新主题:‘tag-banner’ class not being removed when navigating away

Bug:"Required" category of a tag not showing up under "category ..." dropdown

摘要:当从主页创建新主题时,所有类别选项都会显示在编辑器中(符合预期)。但是,当您点击进入一个标签(例如导航到 /tag/tag-name)并尝试从该页面撰写新帖子时,所有类别都会显示出来——但讽刺的是,设置了该特定标签为必需项的类别却除外。

禁用此组件后,此问题停止了。

2 个赞

横幅中的_标签描述_是否易于_渲染_?(或者说,在普通的标签描述中是否易于渲染?)

我觉得能够将其发送到主题或类别,或指示另一个相关标签非常有用……但如果没有渲染,这是不可行的。

谢谢!:purple_heart:

挖出这个帖子 :shovel: :smiley:

“渲染”是指渲染 markdown、表情符号等吗?那将是一个很棒的补充!

2 个赞

如果我没记错的话,您可以在描述中使用 HTML,它应该会被渲染。

1 个赞

在标签/横幅和类别描述中拥有它会很棒。HTML 是可行的,但感觉非常不完善!

3 个赞

我同意这一点

在这种情况下,是否有任何方法也可以在标签横幅中渲染通过标签图标组件添加的图标?

有一个 hide tag icon 设置。可能是这个吗?

设置是 与类别横幅一起使用时隐藏标签图标。无论启用还是禁用,都不会显示任何标签图标。无论是否同时选择类别。
在 3.5.0 stable 上进行了测试