Author name plus avatar

Hello Mike,

Sam’s Simple Theme is overriding the topic-list template and only shows the latest posters not the authors. Here a really cool guide how to override template.

There are 2 templates in core what we should override for this.

  1. https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/templates/topic-list-header.hbr
    topic-list-header to modify the header section.

  2. https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/templates/list/topic-list-item.hbr
    topic-list-item to modify the avatar and add username.


You can find all templates in here: https://github.com/discourse/discourse/tree/main/app/assets/javascripts/discourse/app/templates

Let’s start :arrow_down_small:

Actually I made a theme component to present it easier. You can use it if you want. :slightly_smiling_face:

You can select from two columns with settings.
By default it show the last post but you can change it to show authors.

Topic list header
Firstly we have to modify the column header.

I added these lines and removes posters and views and activity column header.

This is add the header Last Post or Author
Last Post
Screenshot 2022-08-16 at 17.03.19
Author
Screenshot 2022-08-16 at 17.23.35

I’ve also added a locale file to translate these…
You can translate here :arrow_down_small:


Topic list item

I removed the posters column and add the Last Post or Author column.

Last Post Column

Authors Column with (topic creation) time.


Finally add some CSS.


Hope it helps! You can compare with the core templates or if you use any custom templates and change or use the component if it fits your needs. :slightly_smiling_face:

3 Likes