# 分类中置顶话题的帖子头像

**URL:** <https://meta.discourse.org/t/avatars-by-posts-in-category-with-featured-topics/101669>\
**Category:** Support\
**Created:** [2018年十一月9日 15:19 UTC](https://meta.discourse.org/t/avatars-by-posts-in-category-with-featured-topics/101669 "2018-11-09T15:19:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sevosik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sevosik/32/80703_2.png) [@Sevosik](https://meta.discourse.org/u/Sevosik)\
**Post date:** [2018年十一月9日 15:19 UTC](https://meta.discourse.org/t/avatars-by-posts-in-category-with-featured-topics/101669/1 "2018-11-09T15:19:06Z")

</div>

Hi guys,

so I would like to make avatars by posts just like here:

 ![obraz](https://global.discourse-cdn.com/meta/original/3X/6/4/64226ca7b435c1b6aea1aae9894d814efce22e5c.png)

Here:

 ![obraz](https://global.discourse-cdn.com/meta/original/3X/6/c/6c5006d14606ecbaf73a8a887a9cd5180eab55bf.png)

How can I do it?

---

<div class="post-metadata">

**Author:** ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)\
**Post date:** [2018年十一月10日 00:46 UTC](https://meta.discourse.org/t/avatars-by-posts-in-category-with-featured-topics/101669/2 "2018-11-10T00:46:37Z")

</div>

You need to override the template. Some more details on how to do that here: [Developing Discourse Themes & Theme Components](https://meta.discourse.org/t/developer-s-guide-to-discourse-themes/93648/1#heading--4-b-2)

It’s a little harder to find the right template to override here because that category page is a template made of other templates. The one to override is `featured-topic.hbs`

Try adding this code to `</head>` in `admin > customize > themes` — I’ve added the `#user-link` section which should add the avatars, you’ll need to add some CSS to style it as you’d like.

```HBS
<script type='text/x-handlebars' data-template-name='components/featured-topic'>
{{#user-link user=topic.last_poster}}
    {{avatar topic.last_poster imageSize="small"}}
{{/user-link}}
{{raw "topic-status" topic=topic}}
<a class='title' href="{{unbound topic.lastUnreadUrl}}">{{{unbound topic.fancyTitle}}}</a>
{{topic-post-badges newPosts=topic.totalUnread unseen=topic.unseen url=topic.lastUnreadUrl}}

{{#if latestTopicOnly}}
  <div class='last-user-info'>
    {{i18n 'categories.latest_by'}} <a href="{{{unbound topic.lastPosterUrl}}}">{{unbound topic.last_poster.username}}</a>
    <a href="{{unbound topic.lastPostUrl}}">{{format-age topic.last_posted_at}}</a>
  </div>    
{{else}}
  <a href="{{unbound topic.lastPostUrl}}" class="last-posted-at">{{format-age topic.last_posted_at}}</a>
{{/if}}
</script>

```

 ![06%20PM](https://global.discourse-cdn.com/meta/original/3X/0/e/0ee43c56804e5925242c3ecc3ffcee019966d523.png)

---

<div class="post-metadata">

**Author:** ![Sevosik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sevosik/32/80703_2.png) [@Sevosik](https://meta.discourse.org/u/Sevosik)\
**Post date:** [2018年十一月11日 11:41 UTC](https://meta.discourse.org/t/avatars-by-posts-in-category-with-featured-topics/101669/3 "2018-11-11T11:41:27Z")

</div>

Thats so amazing! Thank you so much 😍

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2018年十二月11日 11:41 UTC](https://meta.discourse.org/t/avatars-by-posts-in-category-with-featured-topics/101669/4 "2018-12-11T11:41:27Z")

</div>

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