# 山姆的简单主题

**URL:** https://meta.discourse.org/t/sams-simple-theme/23552
**Category:** Theme
**Tags:** official, sams-simple-theme
**Created:** [2014年十二月31日 03:20 UTC](https://meta.discourse.org/t/sams-simple-theme/23552 "2014-12-31T03:20:14Z")
**Posts on this page:** 20
**Page:** 16

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [2020年四月14日 20:16 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/311 "2020-04-14T20:16:31Z")

</div>

大家好

我需要修改头部代码中的哪一部分才能恢复精选主题摘要？

另外，在更新主题组件后，我的头像在主题列表中消失了：

> **[Forum | Cannabisanbauen.net](https://forum.cannabisanbauen.net/)**
>
> Grow Community von CannabisAnbauen.net. Alles rund um Leidenschaft von Cannabis Anbau

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2020年四月14日 22:36 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/312 "2020-04-14T22:36:37Z")

</div>

我猜你运行的是一个分支版本，最新版本包含头像。

---

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [2020年四月14日 23:44 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/313 "2020-04-14T23:44:33Z")

</div>

刚检查过，我的主题源链接指向 `https://github.com/discourse/discourse-simple-theme.git`  
另外，刚从源链接重新安装了该主题，主题预览中仍存在相同问题。

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2020年四月14日 23:55 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/314 "2020-04-14T23:55:52Z")

</div>

或许可以将 Discourse 更新到最新版本？

---

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [2020年四月15日 00:10 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/315 "2020-04-15T00:10:22Z")

</div>

我使用的是 2.4.1 版本。您指的是 2.5 测试版吗？

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [2020年四月15日 00:24 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/316 "2020-04-15T00:24:53Z")

</div>

是的，头像的更改是在 2.5.0 beta 2 版本中进行的。

---

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [2020年四月15日 10:09 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/317 "2020-04-15T10:09:46Z")

</div>

啊，我明白了。我刚往上翻，[找到了你的临时解决方案](https://meta.discourse.org/t/sams-personal-minimal-topic-list-design/23552/309?u=jrgong)。

@Steven，你能告诉我需要调整那段头部代码的哪一部分，才能重新显示置顶主题的摘要吗？

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [2020年四月15日 10:49 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/318 "2020-04-15T10:49:48Z")

</div>

已经存在一个摘要引用，所以你可能想先删除第 16 行

```plaintext
  {{raw "list/topic-excerpt" topic=model}}

```

然后，我会添加以下内容

```plaintext
  {{#if expandPinned}}
    {{raw "list/topic-excerpt" topic=topic}}
  {{/if}}

```

紧接在这段代码之后

```plaintext
{{raw "list/action-list" topic=topic postNumbers=topic.liked_post_numbers className="likes" icon="heart"}}
   </div>

```

也就是在 `</td>` 之前

如果你使用旧的头部代码，它应该看起来像这样

```js
<script type='text/x-handlebars' data-template-name='list/topic-list-item.raw'>

{{#if bulkSelectEnabled}}
<td class='star'>
  <input type='checkbox' class='bulk-select'>
</td>
{{/if}}

<td class='main-link clearfix'>
  {{raw "topic-status" topic=topic}}
  {{topic-link topic}}
  {{#if controller.showTopicPostBadges}}
    {{raw "topic-post-badges" unread=topic.unread newPosts=topic.displayNewPosts unseen=topic.unseen url=topic.lastUnreadUrl}}
  {{/if}}
  {{discourse-tags topic mode="list"}}
  <div class='creator'>
  {{#if showCategory}}
     {{category-link topic.category}}
   {{/if}}
  {{~#if topic.creator ~}}
  <a href="/users/{{topic.creator.username}}" data-auto-route="true" data-user-card="{{topic.creator.username}}">{{topic.creator.username}}</a> <a href={{topic.url}}>{{format-date topic.createdAt format="tiny"}}</a>
  {{~/if ~}}
   {{raw "list/action-list" topic=topic postNumbers=topic.liked_post_numbers className="likes" icon="heart"}}
   </div>
  {{#if expandPinned}}
    {{raw "list/topic-excerpt" topic=topic}}
  {{/if}}
</td>

{{#if controller.showLikes}}
<td class="num likes">
  {{number topic.like_count}} <i class='fa fa-heart'></i>
</td>
{{/if}}

{{#if controller.showOpLikes}}
<td class="num likes">
  {{number topic.op_like_count}} <i class='fa fa-heart'></i>
</td>
{{/if}}

{{raw "list/posts-count-column" topic=topic}}

<td class="last-post">
<div class='poster-avatar'>
<a href="{{topic.lastPostUr}}" data-user-card="{{topic.last_poster_username}}">{{avatar topic.lastPoster usernamePath="username" imageSize="medium"}}</a>
</div>
<div class='poster-info'>
<a href="{{topic.lastPostUrl}}">
{{format-date topic.bumpedAt format="tiny"}}
</a>
<span class='editor'><a href="/users/{{topic.last_poster_username}}" data-auto-route="true" data-user-card="{{topic.last_poster_username}}">{{topic.last_poster_username}}</a></span>
</div>
</td>
</script>

<script type='text/x-handlebars' data-template-name='topic-list-header.raw'>
  {{#if bulkSelectEnabled}}
  <th class='star'>
    {{#if canBulkSelect}}
        <button class='btn bulk-select' title='{{i18n "topics.bulk.toggle"}}'><i class='fa fa-list'></i></button>
    {{/if}}
  </th>
  {{/if}}
  {{raw "topic-list-header-column" order='default' name='topic.title' bulkSelectEnabled=bulkSelectEnabled showBulkToggle=toggleInTitle canBulkSelect=canBulkSelect}}

  {{#if showLikes}}
     {{raw "topic-list-header-column" sortable='true' order='likes' number='true' forceName=(theme-i18n 'likes')}}
  {{/if}}
  {{#if showOpLikes}}
     {{raw "topic-list-header-column" sortable='true' order='op_likes' number='true' forceName=(theme-i18n 'likes')}}
  {{/if}}
  {{raw "topic-list-header-column" sortable='true' number='true' order='posts' forceName=(theme-i18n 'replies') }}
  {{raw "topic-list-header-column" sortable='true' order='activity' forceName=(theme-i18n 'last_post')}}
</script>

<script>

(function(){

var TopicListItemView = require('discourse/components/topic-list-item').default;

TopicListItemView.reopen({
    showCategory: function(){
        return !this.get('controller.hideCategory') &&
                this.get('topic.creator') &&
                this.get('topic.category.name') !== 'uncategorized';
    }.property()
});

})();

</script>

```

---

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [2020年四月15日 11:10 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/319 "2020-04-15T11:10:01Z")

</div>

> [@Steven](#):
>
> 如果你想在之前修复它，只需编辑主题，在“桌面 \> 页眉”部分，用以下代码替换现有代码

我刚刚将这段代码添加到了主题的页眉部分，但头像仍然没有显示。我是不是漏掉了什么？

> [@Steven](#):
>
> 如果你使用的是旧版页眉代码，它应该看起来像这样

我也尝试了这段代码，头像仍未显示。甚至尝试了安全模式并禁用了所有插件。

> [@sam](#):
>
> 哦，还不行，我需要为此重新调整一下结构

提示：与“主题列表预览”的冲突导致即使使用了提供的代码，摘要也无法显示。

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [2020年四月15日 13:35 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/320 "2020-04-15T13:35:31Z")

</div>

我编辑了之前的帖子，我对所有不同的版本感到有些困惑。

你添加的代码是针对 Discourse 最新版本的。如果我的理解正确，你需要为旧版本的 Discourse 编辑头部，因此我在上一帖中更新了一个适用于 2.5.0 b2 之前版本的代码。

不过，升级 Discourse 会更简单，它会带来许多很酷的新功能：grin:

---

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [2020年四月15日 20:11 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/321 "2020-04-15T20:11:13Z")

</div>

> [@Steven](#):
>
> 不过升级 Discourse 会更容易，还有很多新功能呢 😁

我也很期待 😉

但我还是更倾向于保持稳定版本 😉

感谢更新！

---

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [2020年五月1日 08:49 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/322 "2020-05-01T08:49:59Z")

</div>

@sam 近期是否有计划使主题组件与 [主题列表预览](https://meta.discourse.org/t/topic-list-previews/101646) 插件兼容？

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2020年五月1日 23:23 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/323 "2020-05-01T23:23:14Z")

</div>

暂无具体计划

---

<div class="post-metadata">

### Author: ![b481](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@b481](https://meta.discourse.org/u/b481)
#### Post date: [2020年五月21日 01:03 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/324 "2020-05-21T01:03:23Z")

</div>

我该如何在帖子标题和回复数之间添加一个“用户”列，显示发起每个帖子的用户的姓名和/或头像？这可以通过自定义功能或主题创建器实现吗？

---

<div class="post-metadata">

### Author: ![Mevo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mevo/32/187732_2.png) [@Mevo](https://meta.discourse.org/u/Mevo)
#### Post date: [2020年八月7日 18:03 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/325 "2020-08-07T18:03:28Z")

</div>

我通常在 meta 上使用“Sam 的简单主题”（我非常喜欢）。但从昨天开始，在我这边似乎出现了问题！？我尝试在另一个浏览器的全新安装（用 Firefox 代替 Chrome）上运行，问题似乎依旧：顶部横幅不见了，只显示少量话题，而且点击话题无法打开。切换到其他主题后一切正常。

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [2020年八月7日 19:43 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/326 "2020-08-07T19:43:50Z")

</div>

问题应该已经修复了。感谢反馈此问题 @Mevo 👍

---

<div class="post-metadata">

### Author: ![b481](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@b481](https://meta.discourse.org/u/b481)
#### Post date: [2020年八月17日 04:09 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/330 "2020-08-17T04:09:27Z")

</div>

有没有办法在移动端的主题标题下方显示主题发起者的用户名，就像桌面端那样？

移动端：

![IMG_5113](https://cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/meta/original/3X/d/3/d38cdd00368958548369145dd11bf5c1b69747e2.jpeg)

桌面端：

![desktop](https://global.discourse-cdn.com/meta/original/3X/6/6/66287df5c45e833bbec6ce21d08fafb6aefe129d.png)

---

<div class="post-metadata">

### Author: ![Alex\_P](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alex_p/32/163548_2.png) [@Alex\_P](https://meta.discourse.org/u/Alex_P)
#### Post date: [2021年一月5日 16:55 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/331 "2021-01-05T16:55:16Z")

</div>

看起来该主题与深色模式方案不兼容 :(，因此也与 [Automatic Dark Mode color scheme switching](https://meta.discourse.org/t/automatic-dark-mode-color-scheme-switching/161593) 不兼容。

 ![image](https://global.discourse-cdn.com/meta/original/3X/1/6/163233f83203dbea5c9e1b5e9e1ef2bc43b6694c.png)

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [2021年一月6日 01:05 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/332 "2021-01-06T01:05:15Z")

</div>

我已更新主题以改善暗色模式的兼容性，拉取最新更改后您应该会看到改进。

---

<div class="post-metadata">

### Author: ![Alex\_P](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alex_p/32/163548_2.png) [@Alex\_P](https://meta.discourse.org/u/Alex_P)
#### Post date: [2021年一月6日 07:51 UTC](https://meta.discourse.org/t/sams-simple-theme/23552/333 "2021-01-06T07:51:49Z")

</div>

谢谢 🙂

但是分类名称仍然显示异常。

 ![image](https://global.discourse-cdn.com/meta/original/3X/8/1/81c5da6d95b49264d0ff6eccb3a081b9cc756888.png)  
 ![image](https://global.discourse-cdn.com/meta/original/3X/a/d/ad7d4e736ca12d6d7c9d604fa772156c587161fa.png)

[上一頁](https://meta.discourse.org/t/sams-simple-theme/23552.md?page=15)

[下一頁](https://meta.discourse.org/t/sams-simple-theme/23552.md?page=17)
