# Altering sidebar template from remote theme

**URL:** https://meta.discourse.org/t/altering-sidebar-template-from-remote-theme/246490
**Category:** Development
**Tags:** sidebar
**Created:** [November 23, 2022, 1:15am UTC](https://meta.discourse.org/t/altering-sidebar-template-from-remote-theme/246490 "2022-11-23T01:15:21Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![kaden-stytch](https://avatars.discourse-cdn.com/v4/letter/k/dbc845/32.png) [@kaden-stytch](https://meta.discourse.org/u/kaden-stytch)
#### Post date: [November 23, 2022, 1:15am UTC](https://meta.discourse.org/t/altering-sidebar-template-from-remote-theme/246490/1 "2022-11-23T01:15:21Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [November 23, 2022, 1:39am UTC](https://meta.discourse.org/t/altering-sidebar-template-from-remote-theme/246490/2 "2022-11-23T01:39:03Z")

</div>

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).

> [@kaden-stytch](#):
>
> /javascripts/discourse/sidebar/common/community-section.hbs

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.

---

<div class="post-metadata">

### Author: ![kaden-stytch](https://avatars.discourse-cdn.com/v4/letter/k/dbc845/32.png) [@kaden-stytch](https://meta.discourse.org/u/kaden-stytch)
#### Post date: [November 23, 2022, 2:53am UTC](https://meta.discourse.org/t/altering-sidebar-template-from-remote-theme/246490/3 "2022-11-23T02:53:04Z")

</div>

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

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [November 23, 2022, 10:09am UTC](https://meta.discourse.org/t/altering-sidebar-template-from-remote-theme/246490/4 "2022-11-23T10:09:46Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [December 2, 2022, 3:21pm UTC](https://meta.discourse.org/t/altering-sidebar-template-from-remote-theme/246490/5 "2022-12-02T15:21:42Z")

</div>

@kaden-stytch it’s now possible to override ‘colocated’ component templates in the latest version of Discourse. I’ve written up some documentation for template overrides here:

> [@(not recommended) Overriding Discourse templates from a Theme or Plugin](https://meta.discourse.org/t/overriding-discourse-templates-from-a-theme-or-plugin/247487):
>
> Ideally, when customizing Discourse via themes/plugins, you should use CSS, [the JavaScript Plugin API](https://meta.discourse.org/t/a-new-versioned-api-for-client-side-plugins/40051), or [plugin outlets](https://meta.discourse.org/t/connect-your-theme-to-plugin-outlets-to-inject-templates-with-custom-content/32727). If none of these work for your use-case, feel free to open a PR to Discourse core or start a #Development topic here on Meta. We’re always happy to discuss adding new outlets/APIs to make customization easier. If you’ve exhausted all other options, you may need to resort to template overrides. This technique allows you to override the entire template of any Ember Component or…

Please do make sure you read the warnings at the top and understand the risks. IMO overriding sidebar templates is particularly risky right now because it’s an area of Discourse we’re very actively developing / refactoring.

---

<div class="post-metadata">

### Author: ![kaden-stytch](https://avatars.discourse-cdn.com/v4/letter/k/dbc845/32.png) [@kaden-stytch](https://meta.discourse.org/u/kaden-stytch)
#### Post date: [December 5, 2022, 3:17pm UTC](https://meta.discourse.org/t/altering-sidebar-template-from-remote-theme/246490/6 "2022-12-05T15:17:41Z")

</div>

Makes sense! Thanks for the update David 🙂

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [January 4, 2023, 3:18pm UTC](https://meta.discourse.org/t/altering-sidebar-template-from-remote-theme/246490/7 "2023-01-04T15:18:39Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
