# 主题帖作者徽章

**URL:** https://meta.discourse.org/t/author-badge-for-topic-posts/277579
**Category:** Theme component
**Created:** [2023 年9 月 2 日 16:57 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579 "2023-09-02T16:57:54Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [2023 年9 月 2 日 16:57 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/1 "2023-09-02T16:57:54Z")

</div>

| | | |
| --- | --- | --- |
| ℹ | **摘要** | 为主题所有者的帖子添加徽章。 |
| 🛠 | **仓库** | [https://github.com/VaperinaDEV/author-badge-for-topic-posts](https://github.com/VaperinaDEV/author-badge-for-topic-posts) |
| ❓ | **安装指南** | [如何安装主题或主题组件](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) |
| 📖 | **刚接触 Discourse 主题？** | [Discourse 主题使用入门指南](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) |

安装此主题组件

你好 👋  
通过这个主题组件，你可以在主题所有者的帖子中添加徽章标签。这在大型主题中非常有用，因为你可以清楚地看到谁是原始发帖人。

* * *

## 过滤器

该组件的结构，可以单独定位移动端和桌面端视图。此外，可以单独定位每个类别，从而自定义在哪些类别和视图中显示作者徽章。

这可以通过主题设置实现：

 ![Screenshot 2023-09-02 at 16.56.37](https://global.discourse-cdn.com/meta/original/4X/8/a/9/8a9a4a92b9d243a9e38c9d7aec206d241670e29f.png)

你需要添加 3 个参数才能使该组件正常工作。

1. view-type

2. category-name

3. author-label

示例：

移动端通常空间较小，有时在移动端添加简短版本会很棒。

现在，我为 discourse 类别设置了一个作者徽章，在桌面端将显示“Author”文本，在移动端将显示“OP”文本。

 ![Screenshot 2023-09-02 at 17.01.55](https://global.discourse-cdn.com/meta/original/4X/a/9/9/a9966899c79d63e65f5c337baf47a596211e98c7.png)

* * *

好的，但如果我想在其他类别中使用不同的文本呢？它们必须单独设置吗？当然不是。

如果你将 `view-type` 或 `category-name` 或两者都留空……它将全局应用，而不会覆盖现有的。

示例：

我为其他类别添加了 2 个使用“Original Poster”文本的徽章，并在桌面端和移动端视图中为视频类别添加了“Director”文本。

为此，只需将这些部分留空，并 **输入分号而不留空格**

 ![Screenshot 2023-09-02 at 17.18.43](https://global.discourse-cdn.com/meta/original/4X/2/9/e/29e2ecd43d0d9bd82d58076c3e19208bb32d2463.png)

另一个示例，如果你只想为所有类别和所有视图类型使用例如“Author”。使用以下方法：两个分号（不带空格）和 Author

`;;Author`

* * *

## 位置

让我们看看你可以添加徽章的位置……  
你可以在主题设置中为桌面端和移动端视图分别选择 3 个位置。

 ![Screenshot 2023-09-02 at 17.29.13](https://global.discourse-cdn.com/meta/original/4X/2/e/2/2e292e448d106d6969f7cf7de7d1a4296d1d0ec3.png)

这两个设置 🔽

### 桌面端

`author badge location desktop`

1. below-user-avatar
2. after-user-names
3. below-user-names

**below-user-avatar（空间有限：它使用主题头像的宽度）（固定）** _最好选择一个较短的标签_

 ![Screenshot 2023-09-02 at 17.33.30](https://global.discourse-cdn.com/meta/original/4X/0/d/1/0d14880c21998e7898d57680b7c0c1bf23e3996b.png)

* * *

**after-user-names**

 ![Screenshot 2023-09-02 at 17.35.42](https://global.discourse-cdn.com/meta/original/4X/9/2/c/92c64027cf1862b304b4edcce75f8a8826e0f295.png)

* * *

**below-user-names**

 ![Screenshot 2023-09-02 at 17.36.32](https://global.discourse-cdn.com/meta/original/4X/d/7/7/d776135eebeb194a2c787e46019ae5f53d40f489.png)

* * *

### 移动端

**author badge location mobile**

1. below-user-avatar
2. after-user-names
3. above-user

**below-user-avatar（空间有限：它使用主题头像的宽度）** _最好选择一个较短的标签_

 ![Screenshot 2023-09-02 at 17.40.42](https://global.discourse-cdn.com/meta/original/4X/d/2/0/d2030a77a4818ca24c46c10d72c4cec8a177153c.png)

* * *

**after-user-names（空间有限）** _最好选择一个较短的标签_

 ![Screenshot 2023-09-02 at 17.43.25](https://global.discourse-cdn.com/meta/original/4X/e/7/8/e78b8de4c70ebc44b7876f6f54cdf8de58262150.png)

* * *

**above-user**

 ![Screenshot 2023-09-02 at 17.44.16](https://global.discourse-cdn.com/meta/original/4X/d/7/5/d75f5cb40f8f3337e85a927f7bcab594161a4083.png)

* * *

## 定制

**最后让我们看看一些定制选项。**

 ![Screenshot 2023-09-02 at 17.46.05](https://global.discourse-cdn.com/meta/original/4X/2/2/a/22adf178d8fccead50cb5a64b7610bde3ce15266.png)

在这里，你可以像颜色、字体样式、圆角等一样定制作者徽章。  
例如：

 ![Screenshot 2023-09-02 at 17.52.42](https://global.discourse-cdn.com/meta/original/4X/7/2/b/72bbba5ad0c6cdf2d89ed802a6338be0037e145d.png)  
这个使用了以下值。  
这些颜色变量可能不会在你的网站上使用相同的颜色，这取决于你的配色方案。  
 ![Screenshot 2023-09-02 at 17.53.27](https://global.discourse-cdn.com/meta/original/4X/c/5/6/c56d84ab239c44e44f4421291532f3e92b3531e8.png)

你可以制作出各种酷炫的作者徽章。 🙂

---

<div class="post-metadata">

### Author: ![davidkingham](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidkingham/32/119528_2.png) [@davidkingham](https://meta.discourse.org/u/davidkingham)
#### Post date: [2023 年9 月 5 日 03:31 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/2 "2023-09-05T03:31:44Z")

</div>

我预测未来 Discourse 团队将迎来一位新成员，你制作的一切都太棒了，Don！🍻

---

<div class="post-metadata">

### Author: ![robotnjik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/robotnjik/32/120095_2.png) [@robotnjik](https://meta.discourse.org/u/robotnjik)
#### Post date: [2023 年9 月 5 日 07:24 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/3 "2023-09-05T07:24:52Z")

</div>

非常感谢！

---

<div class="post-metadata">

### Author: ![inj3ct0r](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/inj3ct0r/32/324428_2.png) [@inj3ct0r](https://meta.discourse.org/u/inj3ct0r)
#### Post date: [2023 年9 月 5 日 21:14 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/4 "2023-09-05T21:14:39Z")

</div>

这对我没用 😕

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023 年9 月 5 日 21:20 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/5 "2023-09-05T21:20:00Z")

</div>

您是否考虑过在您的主题中启用该组件？ 🙂

---

<div class="post-metadata">

### Author: ![inj3ct0r](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/inj3ct0r/32/324428_2.png) [@inj3ct0r](https://meta.discourse.org/u/inj3ct0r)
#### Post date: [2023 年9 月 5 日 21:29 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/6 "2023-09-05T21:29:51Z")

</div>

当然！！

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [2023 年9 月 6 日 04:58 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/7 "2023-09-06T04:58:02Z")

</div>

您好 👋

您能再详细说明一下吗？您能分享一下组件设置的截图吗？如果您能分享您的网站网址（如果公开的话），并附上已激活的组件，那就太好了。谢谢！🙂

---

<div class="post-metadata">

### Author: ![inj3ct0r](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/inj3ct0r/32/324428_2.png) [@inj3ct0r](https://meta.discourse.org/u/inj3ct0r)
#### Post date: [2023 年9 月 6 日 08:55 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/8 "2023-09-06T08:55:09Z")

</div>

你好，抱歉来晚了，我的 yml 文件出了问题……这是截图

 ![image](https://global.discourse-cdn.com/meta/original/4X/b/5/c/b5cd97eaea186592b924bb2da6d0d1353eda0fc3.png)

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [2023 年9 月 6 日 09:52 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/9 "2023-09-06T09:52:11Z")

</div>

谢谢 🙂

我在阿拉伯语中检查了它，它对我来说运行正常，除了边距问题……🤔 我将在 RTL 中修复这些问题。我已合并 [UX: Fix RTL compatibility by VaperinaDEV · Pull Request #1 · VaperinaDEV/author-badge-for-topic-posts · GitHub](https://github.com/VaperinaDEV/author-badge-for-topic-posts/pull/1)

你能分享一个主题的截图吗？  
你是否使用了自定义主题或修改了该区域的任何组件？

注意：作者徽章不会出现在主题的第一篇帖子中。

---

<div class="post-metadata">

### Author: ![inj3ct0r](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/inj3ct0r/32/324428_2.png) [@inj3ct0r](https://meta.discourse.org/u/inj3ct0r)
#### Post date: [2023 年9 月 6 日 17:05 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/10 "2023-09-06T17:05:40Z")

</div>

![image](https://global.discourse-cdn.com/meta/original/4X/8/f/a/8fad44da50b33c88ad03974bf4b60a00b53f955e.png)

还是一样 ☹  
我正在使用 #Customization > Theme 中的 stelpolva 主题  
并且我正在使用 Post Badge 组件。

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [2023 年9 月 6 日 19:14 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/11 "2023-09-06T19:14:15Z")

</div>

> [@inj3ct0r](#):
>
> 我正在使用 #Customization > Theme 分类中的 stelpolva 主题。  
> 并且我正在使用帖子徽章组件。

我刚刚用这些进行了测试，效果符合预期。

> [@Don](#):
>
> 注意：帖子徽章不会显示在主题的第一篇帖子中。

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [2023 年9 月 7 日 00:48 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/12 "2023-09-07T00:48:41Z")

</div>

> [@inj3ct0r](#):
>
> 我正在使用 #Customization > Theme 分类中的 stelpolva 主题。

提醒一下：我不再维护这个主题，未来新增的组件可能与之不兼容……

---

<div class="post-metadata">

### Author: ![inj3ct0r](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/inj3ct0r/32/324428_2.png) [@inj3ct0r](https://meta.discourse.org/u/inj3ct0r)
#### Post date: [2023 年9 月 7 日 01:34 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/13 "2023-09-07T01:34:27Z")

</div>

☹ 坏消息

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [2023 年9 月 7 日 05:43 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/14 "2023-09-07T05:43:57Z")

</div>

我检查了您的网站，似乎该组件运行正常……

* * *

但在您分享的第一篇帖子中却不行

> [@inj3ct0r](#):
>

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [2023 年9 月 8 日 22:59 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/15 "2023-09-08T22:59:42Z")

</div>

如果您正在查看第一篇帖子，请注意“作者徽章”不会显示。.它会显示在主题的后续帖子中。正如大家所知，第一篇帖子是原始发布者\作者。这开始让我感到困惑。😉 但作为我站不住脚的辩护，当时是凌晨 3 点。哈哈

* * *

编辑：看，作者已经抢在我前面回答了。🖖😎👍✨

---

<div class="post-metadata">

### Author: ![putty](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/putty/32/370902_2.png) [@putty](https://meta.discourse.org/u/putty)
#### Post date: [2024 年10 月 2 日 17:09 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/16 "2024-10-02T17:09:38Z")

</div>

如果这个更新成为#官方 的话，那将是一个很棒的小小的生活质量改进 👀

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2024 年10 月 2 日 17:14 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/17 "2024-10-02T17:14:31Z")

</div>

为什么会有所不同？

---

<div class="post-metadata">

### Author: ![putty](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/putty/32/370902_2.png) [@putty](https://meta.discourse.org/u/putty)
#### Post date: [2024 年10 月 2 日 18:02 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/18 "2024-10-02T18:02:10Z")

</div>

生活质量可能有点太强了，但我认为它有助于提高话题的可读性，特别是当它试图向 OP 提供信息，而不仅仅是社区之间的对话时。

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2024 年10 月 2 日 18:13 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/19 "2024-10-02T18:13:44Z")

</div>

我不明白它如何能成为#官方…

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [2024 年10 月 2 日 18:19 UTC](https://meta.discourse.org/t/author-badge-for-topic-posts/277579/20 "2024-10-02T18:19:42Z")

</div>

如果 TC 被正式化：它只会意味着团队将维护代码。

现在，如果您是指与核心合并？在我看来，TC 应该更多地保持“单点选择”。另一方面，插件有时确实有合并到核心的意义，但即使那样，除了那些能更好地增强核心大众使用功能（例如自动化、聊天、剧透提醒等）的插件之外，合并所有插件也没有意义。一些插件会因控制臃肿等各种原因而保持可选状态。
