Hey guys, I would like to know if anyone has ever tried to show Views instead of the number of replies in the homepage.
I was able to hide the number of replies using CSS, but I’m having a hard time trying to show the number of Views in that place.
Any ideas?
Thanks!
إعجاب واحد (1)
I’m looking for this very feature. Have you found any solution to this? @Tiago_Amaral
Any updates @Discourse ?
إعجابَين (2)
Lilly
(Lillian Louis)
22 يونيو 2023، 12:44ص
3
i may take a stab at this in next few days if i have time. i am working on a theme component that does something similar.
3 إعجابات
tshenry
(Taylor)
22 يونيو 2023، 8:29ص
4
I went ahead and added a plugin outlet to make it extra easy:
discourse:main
← discourse:post-count-outlet
opened 12:24AM - 22 Jun 23 UTC
Introduces a new above-latest-topic-list-item-post-count outlet, providing a cle… an way to add other useful elements to the topic-stats section of the latest-topic-list-item template.
One example use case is replacing the post count with a view count as requested in [this Meta topic](https://meta.discourse.org/t/show-views-instead-of-replies/187146):
<img width="568" alt="Screenshot 2023-06-21 at 5 21 31 PM" src="https://github.com/discourse/discourse/assets/22733864/912b77ed-887e-4402-a50d-0079ef61666d">
If you add something like this to the Head section of a theme component, you’ll see it adds the views. You can add additional HTML if needed and style to taste from there
<script type="text/x-handlebars" data-template-name="/connectors/above-latest-topic-list-item-post-count/views-count">
{{topic.views}} views
</script>
إعجابَين (2)
Lilly
(Lillian Louis)
22 يونيو 2023، 10:25ص
5
oh nice. thank you. @tshenry
إعجاب واحد (1)
Lilly
(Lillian Louis)
24 يونيو 2023، 4:18ص
6
ok so i put this functionality into a theme component that has settings for controlling all three stats in the topic list of the main category page - total number of views, replies count, and time since last activity.
إعجابَين (2)