# Tag Icons 突然将 slug 中的下划线转换为连字符，导致图标失效

**URL:** <https://meta.discourse.org/t/tag-icons-suddenly-converting-underscores-to-dashes-in-slugs-breaking-the-icon/403428>\
**Category:** Bug\
**Tags:** tags, tag-icons\
**Created:** [2026年五月20日 07:16 UTC](https://meta.discourse.org/t/tag-icons-suddenly-converting-underscores-to-dashes-in-slugs-breaking-the-icon/403428 "2026-05-20T07:16:37Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2026年五月20日 09:35 UTC](https://meta.discourse.org/t/tag-icons-suddenly-converting-underscores-to-dashes-in-slugs-breaking-the-icon/403428/4 "2026-05-20T09:35:19Z")

</div>

在安装此组件并进行测试之前，我猜测问题出在标签名称中的 `_` 下划线。看起来所有包含下划线的标签都没有显示其图标。

 ![Screenshot 2026-05-20 at 2.28.49 AM](https://global.discourse-cdn.com/meta/original/4X/6/b/f/6bf4a3e2b6def2a31fc7b781f8e769ab451e4da9.png)

![Screenshot 2026-05-20 at 2.29.00 AM](https://global.discourse-cdn.com/meta/original/4X/9/d/2/9d272bd09154622275fea41cc3ae1ecbbf08efec.png)

我认为这个提交将你带有下划线 `_` 的标签 slug 重新配置为连字符 `-`。

> <https://github.com/discourse/discourse-tag-icons/commit/46ee338ae4fb7b316e25501744e779f5f96c48e9>
>
> When content localization is enabled, tag icons break because the component matc…hes on \`tag.name\` which gets translated.
> 
> This switches iconTagRenderer to match on tag.slug instead. Slugs are not translated, and matches the actual description of the setting as well.

 ![Screenshot 2026-05-20 at 2.34.59 AM](https://global.discourse-cdn.com/meta/original/4X/d/9/9/d99485581d3db92ac69a09c47a19b206fda16a43.png)

---

_[View the full topic](https://meta.discourse.org/t/tag-icons-suddenly-converting-underscores-to-dashes-in-slugs-breaking-the-icon/403428)._
