Trying to show topics on custom menu item

In order to learn/apply different discourse concepts, I am building a plugin which will display all the Hot Topics. I haven’t decided the criteria for what a hot topic is yet, but these are the issues I am facing.

I’ve also mentioned my thought-process along with the issue, and I would like more of a thought-process based solution instead of the actual solution which would help me think clearly and generally for solving many other problems.

I’ve created a new menu item using api.addNavigationBarItem.
I’ve also created a custom route called /hot-topics in the frontend and backend.
Right now, I am displaying a simple h3 heading on the /hot-topics route.

  1. My first task is that once I click the NavItem, the navigation bar should still be visible and Hot Topics tab should be highlighted.
    I think this will be possible with {{navigation-bar}} component, but I think I need to return the navItems in the model method of the route object so that it be passed to the template.
    I returned a hardcoded array from the model method but with no luck.

  2. My second task is to fetch the so-called Hot Topics and display them on the Hot Topics tab.
    for that, I am using {{categories-topic-list}} component. I have a hard time figuring out how I should pass the data to this component to display the needed topics.

Please do suggest some ideas on how to proceed with this. Also, what would be your thought process while trying to solve this problem?

1 Like

Thanks for trying to learn Discourse!

I understand it’s a learning experience, but I do have a question right off the bat: what is the difference between Hot and visiting /top to see what we think are top? You can filter it by week or even day if you like. That is supposed to be our “Hot”.

You might want to consider adding your route as part of the discovery. routes, like we do for latest, new, top, etc. Those routes already will render the navigation bar for you. I would suggest looking at discourse code to see how the other routes are created. They will have examples on how to fetch data for their lists of topics.


I realized the fact that I need to reuse the stuff instead of recreating it after some time of going through this exercise. I went through this course to get a deeper understanding of ember concepts.

With that and the idea you shared about the discovery. routes, I am gonna dive into the discourse code to see if I can get a clear understanding of how discourse fetches the data for those routes and passes it to the component.

Thanks a lot for your time @eviltrout.