How to get the latest topics list from a plugin

OK

A good strategy with all modifcations is do the minimum needed: find something that exists that is closest and modify that. This is not just because we are all inherently lazy as programmers, but because you want to have the minimum exposure to risk wrt changes to the core code so your functionality has the best chance of survival with minimal changes going forward.

I hope I’ve understood your requirement correctly. In any case here goes:

I can’t go into huge detail here (as need to put dinner on the table tonight), but here’s the strategy I would employ here:

  1. Note the closest data arrangement to what I think you need is ‘Boxes with Featured Topics’. When you simply render the /categories.json in this mode you will note the data comes back in a way that is close to what you might need, that is Categories with short nested lists of topics for each Category - handy!

  2. Consider changing the featured topics method in the ruby controller to spit back the latest topics (or whatever) instead of ‘featured’: discourse/app/models/category_featured_topic.rb at main · discourse/discourse · GitHub

  3. Override the template(s) for this mode to rearrange the elements in the way that you prefer. I’d take a look at this template to start with: https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/templates/components/categories-boxes-with-topics.hbs

NB One thing to be wary of is why things are like they are already. The Category Boxes layout is designed to give you a quick view of as many Categories on the same page as possible. Having it all going linearly down the page instead may undesirably push some Categories off screen

One compromise is to just do part 2 only with no layout changes - an added bonus being it’s quicker and it’s less risky.

That’s how I’d start to go about this … you may find your strategy needs modification as you work through it.

Hope that’s helpful and gets you going. Sorry I can’t spend significant time on it at present.