Altering sidebar template from remote theme

Hi!
I have a remote theme and I would like to override the components/sidebar/common/community-section template or component. I’ve tried overriding the handlebars template in my remote theme with /javascripts/discourse/sidebar/common/community-section.hbs, but that doesn’t seem to work. I also tried using api.modifyClass("component:sidebar/common/community-section", ...) but that also doesn’t seem to register.

Why the handlebars templates are in this directory instead of the templates directory? And, do you have any suggestions on how I can alter this component/template or if I’m doing something wrong?

2 Likes

We’re working on updating Discourse to the latest version of Ember, and one of the new features is template colocation (templates and the relevant JS file can be located in the same directory).

I think the correct path should be /javascripts/discourse/components/sidebar/common/community-section.hbs but I just tested that and it’s not working for me either… I’ll double-check with the team working on these upgrades.

Oo yeah that’s actually what I tried! Thanks for checking with the team Kris!

Hi @kaden-stytch - the Sidebar, and a few other parts of Discourse, are using a more modern approach for handling templates (Ember’s Colocated Component Templates). Right now we don’t have any way for them to be overridden from themes/plugins, but it’s something I have on my list to improve.

I’ll let you know once we have a solution. Fingers crossed that’ll be in the next couple of weeks.

3 Likes