如何在用户名右侧显示“作者”

你好,

我希望在用户名右侧显示一个标题(属性?)为 “author” 的标记,以标识话题作者。

如果话题作者回复了帖子,我们就能看到右侧显示“author”字样。效果如下:

或者

请问有人知道如何实现吗?
非常感谢!:heart:

这是我的一些思考,但我不确定如何实现。

如果某人是话题的创建者
则在用户名右侧显示“作者”
否则,不显示任何内容

这是我上次用来显示帖子编号的一些代码,我觉得可以参考这个思路。

a.post-date span {
margin-right: 1em;
}

a.post-date:after {
content: attr(data-post-number)“帖子”;
}

1 个赞

你好 @neo

我之前做过这种作者徽章……你可以在这里看到:↓ 希望这能帮到你 :slightly_smiling_face:

3 个赞

非常感谢!:heart::heart::heart: 这正是我所期待的!

以下是我基于你的代码所做的自定义修改。

Selection_813

另外,我注意到在桌面端,“作者”信息会在其他回复者之后被隐藏。在我的情况下,效果如下:

// 从嵌入帖子中隐藏
.topic-owner article .row .embedded-posts .topic-body .topic-meta-data .names::after {
content: “”;
border: none;
padding: none;
}

但在移动端却不需要这样,这是为什么呢?:thinking:

1 个赞

很高兴你喜欢 :heart::slightly_smiling_face:

如果你在 Discourse 上使用了新的过滤回复功能(Meta 也在用),则不需要使用

// Hide from embedded posts 这一行
.
.
.

只需使用以下代码行 :arrow_down:


因为嵌入式回复功能在移动设备上默认并未启用。:slightly_smiling_face:

1 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.