# Best strategy for finding the right template to edit?

**URL:** https://meta.discourse.org/t/best-strategy-for-finding-the-right-template-to-edit/153598
**Category:** Development
**Created:** [2 juni 2020 om 17:49 UTC](https://meta.discourse.org/t/best-strategy-for-finding-the-right-template-to-edit/153598 "2020-06-02T17:49:43Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)
#### Post date: [2 juni 2020 om 17:49 UTC](https://meta.discourse.org/t/best-strategy-for-finding-the-right-template-to-edit/153598/1 "2020-06-02T17:49:43Z")

</div>

I’m still new to Discourse, but learning more about how to code on top of it to customize things. I’m trying to learn the best way to insert code in particular spots on a page (more targeted than in a general outlet area). It looks like I’ll have to [override the template](https://meta.discourse.org/t/developer-s-guide-to-discourse-themes/93648) that controls that spot.

I take that to mean that, whether I do it in the area of my customize dashboard, or in a separate github repo I’ll use as a theme, I will have to:

1. Find the right template to edit
2. Reprint the whole template wherever I am doing my coding (dashboard, repo, etc.), and
3. make the changes I want to the template

Step 1 is proving to be a hurdle. **How do I find the right template to edit?**

This is what I gather: The discourse templates are [here](https://github.com/discourse/discourse/tree/master/app/assets/javascripts/discourse/app/templates), and it seems that the “real” templates I’ll want to edit are generally in the components file [here](https://github.com/discourse/discourse/tree/master/app/assets/javascripts/discourse/app/templates/components).

As an example, say I want to add a line to each group listing on the group index page (the equivalent of [this page)](https://meta.discourse.org/g). Where is the template for that? My best guess is that it’s the [group card templates](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/app/templates/components/group-card-contents.hbs) template, but I’m not sure, especially because I’m brand new to Ember.

Is there a more sure fire way for me to identify the right template?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2 juni 2020 om 18:40 UTC](https://meta.discourse.org/t/best-strategy-for-finding-the-right-template-to-edit/153598/2 "2020-06-02T18:40:40Z")

</div>

Did you try the Ember browser extension?

It shows template and components:

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/6/e6b7b162f1648d67c799cf88bb75864fb1078efc.png)

---

<div class="post-metadata">

### Author: ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)
#### Post date: [2 juni 2020 om 18:44 UTC](https://meta.discourse.org/t/best-strategy-for-finding-the-right-template-to-edit/153598/3 "2020-06-02T18:44:18Z")

</div>

That sounds great. Do you mean the [Ember Inspector](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)?

---

<div class="post-metadata">

### Author: ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)
#### Post date: [2 juni 2020 om 18:53 UTC](https://meta.discourse.org/t/best-strategy-for-finding-the-right-template-to-edit/153598/4 "2020-06-02T18:53:20Z")

</div>

Got it. Using it, there’s one thing I’m not getting (probably has to do with my being new to ember):

If you look at the discourse [groups page](https://meta.discourse.org/g), each group entry has a name and user-count.

Using the Ember inspector, I can see the name is from the groups-info template, but where does the group-user-count come from? (it doesn’t seem to have an entry in the ember inspector)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2 juni 2020 om 19:11 UTC](https://meta.discourse.org/t/best-strategy-for-finding-the-right-template-to-edit/153598/5 "2020-06-02T19:11:21Z")

</div>

> <https://github.com/discourse/discourse/blob/7a2e8d3ead63c7d99e1069fc7823e933f931ba85/app/assets/javascripts/discourse/app/templates/groups/index.hbs>

---

<div class="post-metadata">

### Author: ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)
#### Post date: [2 juni 2020 om 19:16 UTC](https://meta.discourse.org/t/best-strategy-for-finding-the-right-template-to-edit/153598/6 "2020-06-02T19:16:17Z")

</div>

Thanks. I see on group-user-count appears on line 55.

Does this mean that if I wanted to, say, add a line right before the group-user-count line, I would have to copy the entire 100 lines of that index.hbs file into my code and insert it like this:  
`<script type="text/x-handlebars" data-template-name="groups/index">`  
[100 lines here]  
`</script>`

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2 juni 2020 om 19:55 UTC](https://meta.discourse.org/t/best-strategy-for-finding-the-right-template-to-edit/153598/7 "2020-06-02T19:55:08Z")

</div>

- Normally you check if there is a suitable plugin outlet, and use that.
- you can try and target things with jQuery, but that’s not going to work if you are trying to change an iterative element.

If you can’t do either of those things:

- ask Discourse team to add a plugin outlet providing justification
- replace the entire template with your own as you suggest.

---

<div class="post-metadata">

### Author: ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)
#### Post date: [2 juni 2020 om 21:05 UTC](https://meta.discourse.org/t/best-strategy-for-finding-the-right-template-to-edit/153598/8 "2020-06-02T21:05:00Z")

</div>

> [@merefield](#):
>
> Normally you check if there is a suitable plugin outlet, and use that.

Do you mean changing the code in the outlets around it? (like components/group-info)

EDIT: Sorry, I confused templates and plugin outlets. I understand that plugin outlets are lines in the discourse code (like `{{plugin-outlet name="topic-above-post-stream" args=(hash model=model)}` ) the discourse team has put there as an anchor you can use to change the code.

---

<div class="post-metadata">

### Author: ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)
#### Post date: [3 juni 2020 om 16:02 UTC](https://meta.discourse.org/t/best-strategy-for-finding-the-right-template-to-edit/153598/9 "2020-06-03T16:02:30Z")

</div>

EDIT: Moved this follow up to [here](https://meta.discourse.org/t/inserted-full-group-index-template-but-it-wont-show-any-groups/153743) bc its on a slightly different issue.
