Ideally I would prefer to do it like you have suggested, however, there isnt a way to display categories in a grid layout and have the latest topics below.
I suggest building a static header customization if your categories do not change much. Then you could have whatever layout you like above the topic list.
I’ve built this or something similar for a few sites at this point. If you put this in the </head> section of your theme it will put all the categories on top of your home page (and /latest assuming that it’s the same as your homepage)
Then all you’ll need is add the CSS to structure this layout however you want. This is a good introduction to using the API and Handlebars templates in general.
Thank you for this code snippet! I am working on a project where I need to do some things on this principle (not necessarily categories) and I would like to put this directly in the plugin that I develop.
I know where to put the template handlebars, but I can not find the folder / file where to put the javascript. Could you tell me how to proceed?
Yes, there was an error! Thanks for reporting it. I’ve fixed the code in the post above.
We turned strict mode on for our JavaScript, which means categoryName = []; needs to be declared, changing that line to let categoryName = []; was the fix.
Okay… I will need to figure out how to make an hbs work as something I can add to discourse. I guess I have to use this as a file in a component and I need to do a tutorial on that?
I saw one tutorial with a simple theme. Is that the right direction to go?
I’ll let you know if I’m successful. In the interim, I plugged in the Air theme and I’m quite happy, but I would still love to get latest posts below the category topics.
I was once an msvc++ programmer 25 years ago, and I did manage to build a playstore released flutter app. Open source api’s are not easy for me though. We will see how things go. I’ll post an update when I can.
Utilizing the desktop category page style “Boxes with Subcategories” setting I was able to create a Theme Component and add code below the Boxes. I’m now figuring out how to list the latest topics on the whole site.