Im an employee at Jupiter.community (Categories - Jupiter Community). In the latest section, if a post has 0 likes, there is an empty blank. How do I make it so that it shows a physical number 0 with the like icon? [eg: Look at “Cost of living in Pune” post in screenshot, I want it to show 0 likes]
AI-generated summary
In a support discussion titled “0 likes in latest section,” CommunityJ, an employee at Jupiter.community, reports that posts with zero likes display as blank in the latest section and wants them to show “0” with the like icon. hawm suggests this is due to a theme component (specifically, the discourse-like-column) evaluating zero likes as false. hawm explains that Discourse core intentionally hides zero likes and advises modifying the built-in topic-list-item component by overriding its hasLikes function to return true when likes equal zero. CommunityJ notes they don’t have that component installed, to which hawm clarifies it’s part of Discourse core and recommends reviewing the Developer’s Guide to Discourse Themes. CommunityJ finds the guide lacking detail on modifying core components, and hawm points them to the modifyClass() function as the correct approach for overriding core behavior in themes.
Did you using any theme component to add the like column? I think it because the Javascript from the theme component eval the like cout 0 to false.
Yes, I used this theme component - GitHub - discourse/discourse-like-column: Add the Like column to the /latest homepage · GitHub
It seems Discourse only show Likes greater than 0 by design, you need to reopen the the topic-list-item component class then replace the hasLikes function that eval to true when likes count is 0.
I don’t have a component called topic-list-item installed
Yes, it build in the Discourse core. You may need to know more about it
I couldn’t find out much about changing Discourse core components in this link, where else can I understand this better?
You miss the modifyClass() function.
