Avatars by posts in Category with Featured Topics

(Sevos) #1

Hi guys,

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


How can I do it?

(Kris) #2

You need to override the template. Some more details on how to do that here: Developer’s guide to Discourse Themes

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.

<script type='text/x-handlebars' data-template-name='components/featured-topic'>
{{#user-link user=topic.last_poster}}
    {{avatar topic.last_poster imageSize="small"}}
{{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>
  <a href="{{unbound topic.lastPostUrl}}" class="last-posted-at">{{format-age topic.last_posted_at}}</a>

(Sevos) #3

Thats so amazing! Thank you so much :heart_eyes: