Adding a column to topic list

Hi,

I’d like to add a column to the topic listing shown on the homepage. Do I need to create both a theme component and a plugin to accomplish this? This entails overriding both app/assets/javascripts/discourse/app/templates/topic-list-header.hbr and app/assets/javascripts/discourse/app/templates/components/topic-list-item.hbs to the best of my knowledge. If possible, I’d like to do this in a self-contained plugin rather than requiring a separate theme component.

I’m new to Discourse so any pointers would be much appreciated!

Yes. those are indeed the templates you will need to override.

You don’t need to create both a plugin and a theme component.

You can override both templates from within a theme component. A good example is the Discourse Topic Author theme component.

But you can only use a theme component for this if the desired information is already present in the json for the topic list. If it’s not, then you will need to use a plugin that does not only override the theme components but also serializes the information to the json.

4 Likes