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.
D’accord… Je vais devoir trouver comment faire fonctionner un hbs comme quelque chose que je peux ajouter à Discourse. Je suppose que je dois l’utiliser comme un fichier dans un composant et que je dois faire un tutoriel à ce sujet ?
J’ai vu un tutoriel avec un thème simple. Est-ce la bonne direction à suivre ?
Je vous tiendrai au courant de mon succès. En attendant, j’ai activé le thème Air et j’en suis très satisfait, mais j’aimerais toujours avoir les derniers articles sous les sujets de catégorie.
J’ai été programmeur msvc++ il y a 25 ans, et j’ai réussi à créer une application Flutter publiée sur le Play Store. Les API open source ne sont cependant pas faciles pour moi. Nous verrons comment les choses évoluent. Je posterai une mise à jour quand je le pourrai.
Avez-vous réussi ? Je cherche à faire la même chose, je me demande s’il existe une solution simple ou si je dois plonger dans le thème et y passer du temps.
En utilisant le style de page de catégorie de bureau “Boîtes avec sous-catégories”, j’ai pu créer un composant de thème et ajouter du code sous les boîtes. J’essaie maintenant de savoir comment lister les derniers sujets sur l’ensemble du site.