Avatars by posts in Category with Featured Topics

Hi guys,

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

Here:

How can I do it?

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"}}
{{/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>

12 Likes

Thats so amazing! Thank you so much :heart_eyes:

2 Likes

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