A "Votes" option for the top menu in main page

The Voting plugin offers a “Votes” item for the top menu in the categories where it is enabled. Clicking this option users get a list of most voted topics in that category.

For sites built around this Voting feature it would be very useful to have a “Votes” option in the main page top menu. Admins could set the Votes view as default, and users could too in their preferences, just like Latest, Categories, Top…

If the Votes are enabled in more than one category, this view would provide a consolidated ranking of voted topics from multiple categories.

1 Like

I just learned that appending “/votes” to the Discourse instance URL provides that consolidated list of votes. Example:

Therefore what is only missing is the possibility to add a “Votes” option in the top menu.

Can this be achieved with a theme component, or must this addition be made to the Voting plugin?

Hi @quimgil
Try GitHub - discourse/Discourse-nav-links-component
If you want to add a link to the navigation menu.

Do you prefer it visible for all members? Or particular groups?

1 Like

Ah yes, the Custom top navigation links. Good point, thank you.

I wonder how this theme component will affect the “Votes” and “My Votes” links that appear in the top menu of the categories where voting is enabled. I have read the extensive comments about how this theme compent affects the navigation of categories and I didn’t get a clear impression. I’ll have to try, but I have the impression that I will resolve one problem at the expense of causing a few new ones?

The behavior requested is exactly the same that other two very popular plugins offer: Events Plugin 📆 and Locations Plugin. Both bring a top menu item that can be added and removed just like Discourse’s top menu items:

If “Votes” is the first item in the top menu, the “/votes” page would be shown by default.

Maybe there is some code from these plugins that could be reused? If a PR is welcome and @angus or someone else is interested, we could even “marketplace this” (I have no idea how simple/complex writing and testing the patch would be).

Something like this would work:

Adds two settings:

  • voting_show_votes_on_homepage: ‘Show vote list navigation item on homepage?’
  • voting_show_votes_before: ‘Show vote list navgiation item before this navigation item’

Note that I’ve left it in draft state as there’s curently a difference between /votes and /latest?order=votes in the plugin which affects this feature. Will need some input from a maintainer on that first.

3 Likes

@angus, you rock in so many ways. Thank you so much!

Interesting. /votes seems to have “latest” as second sorting criteria for topics with the same number of votes. This would be expected in /latest?order=votes, but for some reason the second sorting criteria is different. I wasn’t able to find the pattern.

Also a note just in case someone touches the sorting criteria. Right now topics with zero votes and topics with no concept of votes are all mixed. It would make more sense to have all the topics with zero votes together, and then the topics without voting enabled at the end, separate.

1 Like

This is moved from draft to published.

3 Likes