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. discourse/topic-list-header.hbr at main · discourse/discourse · GitHub
    topic-list-header to modify the header section.

  2. discourse/topic-list-item.hbr at main · discourse/discourse · GitHub
    topic-list-item to modify the avatar and add username.


You can find all templates in here: discourse/app/assets/javascripts/discourse/app/templates at main · discourse/discourse · GitHub

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.
Screenshot 2022-08-16 at 17.00.54

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


Author

I’ve also added a locale file to translate these…
You can translate here :arrow_down_small:
Screenshot 2022-08-16 at 17.05.07


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