tshenry
(Taylor)
June 22, 2023, 8:29am
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 Likes