Template for Customizing Homepage

We have been reading the theming guide here: Developer’s guide to Discourse Themes and have been trying to customize the homepage on Discourse. However, we cannot locate the template in the templates folder that controls the output of the home page (discourse/app/assets/javascripts/discourse/templates at master · discourse/discourse · GitHub) . Which template does this? Or is there a generic template that the homepage relies on and there are conditional statements to use to determine if a user is on homepage or not? If so, what is this generic template and what are the conditionals? Thanks.

It depends what your modifications are.

The ‘homepage’ is here: discourse/discovery.hbs at master · discourse/discourse · GitHub

The best way to modify this and its child elements is via CSS , Theme Components and Plugins (in order of increasing complexity).

I would not advise overriding this template completely as you risk breaking the forum as discovery.hbs may get updated from time to time and your override will obscure these updates (though of all the templates, discovery.hbs doesn’t seem to get updated that often). However, some of the child templates, like topic.hbs can get updated every few days!

Plugins and Theme components can do various things but you can ‘connect’ things via the plugin outlets without disturbing the shipped core templates themselves.

If you want to add ‘side widgets’ I would recommend the Custom Layouts Plugin, but you have to build widgets for that (if the existing ones don’t suffice). That’s fairly straightforward though.

3 Likes