Dev Question: Multiple Topics - Categories Page

NodeBB Development
  • I'm trying to develop a newspaper/blog type theme for NodeBB. Its been about a year since I've looked at the code /templates and have what might be a very basic question.

    On the 'categories' home page, using Lavendar / Persona themes as an example, I see that the category is displayed and the latest topic.

    What if I wanted to make the display like this:

    -- 10 Latest Topics

    I see

                                                   <!-- BEGIN posts -->
                                                    <!-- END posts -->

    However, it appears that there is only one latest post here.

    Without modifying the code, is there a way for the theme to specify that it wants an X number of topics. Also, is there a way for the theme to specify that it only wants the topic meta and not the actual full post perhaps?

  • @shri said in Dev Question: Multiple Topics - Categories Page:

    Without modifying the code,


  • Ok, So if we were to modify code, would it be core code?

    Just to get a start, can you point out where the code for this would be so I can start reading it?

  • @shri No real need to modify core code. You should be able to do everything you want inside the hook

    The data returned is what you see at api/categories

    You would modify that by adding a topics array to each category. Using a method similar to what src/controllers/category.js does to retrieve the topics.

    Then in the template you can add a <!-- BEGIN topics --><!-- END topics --> section for each category.

  • @yariplus thanks. That has given me a ton of areas to research / grep and try out.

Suggested Topics