# 如何在Fakebook主题中显示FullName在主题中

**URL:** https://meta.discourse.org/t/how-to-display-fullname-on-topics-in-fakebook-theme/235580
**Category:** Development
**Created:** [2022 年8 月 9 日 10:27 UTC](https://meta.discourse.org/t/how-to-display-fullname-on-topics-in-fakebook-theme/235580 "2022-08-09T10:27:20Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### 作者： ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### 发布日期： [2022 年8 月 9 日 14:25 UTC](https://meta.discourse.org/t/how-to-display-fullname-on-topics-in-fakebook-theme/235580/5 "2022-08-09T14:25:52Z")

</div>

您好，

这看起来是 [Fakebook，一个为社交媒体爱好者设计的主题](https://meta.discourse.org/t/fakebook-a-theme-for-social-media-lovers/109079) 主题。Fakebook 主题在主题列表中使用自定义模板来显示用户名，但您可以修改此模板以显示全名。🙂

为此，您需要 Fork 该主题在 Github 上，并编辑模板文件。这是您需要在 Fork 中修改的文件：[https://github.com/discourse/Fakebook/blob/main/javascripts/discourse/templates/list/custom-topic-list-item.hbr](https://github.com/discourse/Fakebook/blob/main/javascripts/discourse/templates/list/custom-topic-list-item.hbr)

此模板包含一个处理主题列表中用户数据的部分。您需要编辑它。

> <https://github.com/discourse/Fakebook/blob/41020a5fd962644cc0556023cabef86cff0c4747/javascripts/discourse/templates/list/custom-topic-list-item.hbr#L16-L19>

这行显示用户名。🔽

`<span>{{topic.posters.[0].user.username}}</span>`

所以我们需要在此之前或之后添加全名。

* * *

要添加全名，只需简单地将此部分更改为类似以下内容：🔽

```xml
<div class="name-and-date">
  <span class="full-name-topic-list">{{topic.posters.[0].user.name}}</span>
  <span class="username">{{topic.posters.[0].user.username}}</span>
    {{format-date topic.createdAt format="tiny"}}
</div>

```

我在 `username` 之上添加了这一行，它将在主题列表中显示全名，位于用户名之上。

`<span>{{topic.posters.[0].user.name}}</span>`

可能需要一些 CSS 更改，但您可以轻松地定位 `full-name-topic-list` 类或您添加的任何类。

* * *

我现在 Fork 了 Fakebook 主题，并在以下 commit 中进行了此更改，您可以查看它：[Add full name to topic list · VaperinaDEV/Fakebook@0978133 · GitHub](https://github.com/VaperinaDEV/Fakebook/commit/0978133e62a4f0c24c07e1ae4225bc83524dded8)

这就是它的样子。

Don - Full Name  
dodesz - Username

 ![Screenshot 2022-08-09 at 16.19.54](https://global.discourse-cdn.com/meta/original/4X/5/1/e/51eac08249579eed20f4eb52b8e61b9bf88cb4c1.png)

希望这有帮助 🙂

---

_[View the full topic](https://meta.discourse.org/t/how-to-display-fullname-on-topics-in-fakebook-theme/235580)._
