Display Like Counts on Home Page Topic List


(Aislinn Chen) #1

Is it possible to display like counts on the home topic list next to “Replies”?


#2

Yes, just add:
/?order=op_likes
at the end of your URL.

Example:
Discourse Meta


(Aislinn Chen) #3

does it mean we have to change the home page URL to this in our application set up?


(Daniela) #4

Use this script, add it in admin/customize/css_html in the </body> tab

<script>
var TopicListComponent = require('discourse/components/topic-list').default;
TopicListComponent.reopen({
    showLikes: true
});
</script>

It shows the column Like in your homepage between the columns Replies and Views.


(Bart) #5

Thanks Daniela! 2 questions though if you don’t mind:

  • Will this perform any additional HTTP requests to the server? I’m on a high traffic server and need to be careful with adding more load.
  • Can you also make this show only the op_likes?

(Vinoth Kannan) #6

No.

In that case you have to set showOpLikes: true in above code instead of showLikes.


(Bart) #7

Hmm, when I do that the likes column will be displayed, but not a single post displays a like. I did confirm that several of them have likes on the OP.


(Vinoth Kannan) #8

Then you have to use above solution from SidV. That will work perfectly.


(Ryan LaLiberty) #9

Could anyone tell me how to modify the above code from @Dax so it just shows Likes on one subforum?