# How to change category names via theme-component

**URL:** https://meta.discourse.org/t/how-to-change-category-names-via-theme-component/279742
**Category:** Development
**Created:** [September 22, 2023, 4:54am UTC](https://meta.discourse.org/t/how-to-change-category-names-via-theme-component/279742 "2023-09-22T04:54:34Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [September 22, 2023, 4:54am UTC](https://meta.discourse.org/t/how-to-change-category-names-via-theme-component/279742/1 "2023-09-22T04:54:34Z")

</div>

I’m seeking for advice, how to change category titles in different areas of the interface.

**Background:** We are using quite long category titles for our school community, to give users enough background to know, which audience the category targets. We also repeat the name of the top category in the name of the subcategory.

 ![image](https://global.discourse-cdn.com/meta/original/4X/8/7/f/87f2e7efdf27a59394f83e714032b7a232ee77ce.png)

I would like to be able to change the titles to include linebreaks

 ![image](https://global.discourse-cdn.com/meta/original/4X/8/b/a/8ba8608b2285c79b2099184301cd348c03eda003.png)

or be able to just omit the first part.

Another place is the “link bar”, where long names are abbreviated with dots at the end.  
I would like to implement either an option for a short name or to use the ellipsis at the beginning:

 ![image](https://global.discourse-cdn.com/meta/original/4X/2/3/a/23ae6cc50f1e153d7e2d32ef7356c3ac3bef20d8.png)

---

<div class="post-metadata">

### Author: ![Rhababo](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@Rhababo](https://meta.discourse.org/u/Rhababo)
#### Post date: [September 29, 2023, 6:00pm UTC](https://meta.discourse.org/t/how-to-change-category-names-via-theme-component/279742/2 "2023-09-29T18:00:31Z")

</div>

For the first part, since you’re adding things to the existing category titles there are a few places that you could inject extra html via plugin component:

 ![Screenshot 2023-09-29 at 12.15.58 PM](https://global.discourse-cdn.com/meta/original/4X/a/4/3/a43ccf9f851bb70cfb1ff306bc5398b3fc64a967.png)

You can use this theme component to get an idea of where you can input things to your site:  
[https://github.com/communiteq/plugin-outlets-theme-component](https://github.com/communiteq/plugin-outlets-theme-component)

This section goes into more detail on how you can add items to plugin outlets:

> [@Developing Discourse Themes & Theme Components](https://meta.discourse.org/t/beginners-guide-to-developing-discourse-themes/93648#):
>
> Discourse Themes and Theme Components can be used to customize the look, feel and functionality of Discourse’s frontend. This section of the developer guides aims to provide all the reference materials you need to develop simple themes for a single site, right up to complex open-source theme components. This introduction aims to provide a map of all the tools and APIs for theme development. If you prefer a step-by-step tutorial for theme development, jump straight to: Themes vs. Theme Compon…

As for changing the names on the sidebar…here’s the code that controls that:

> <https://github.com/discourse/discourse/blob/5f3265fe017d06fb165d0fd6ef668c813b830e65/app/assets/javascripts/discourse/app/lib/sidebar/user/categories-section/category-section-link.js#L186C1-L188C4>

Overriding this function to something like

```plaintext
get text(){
    return "..."+this.category.name.substr(-10)

```

could work for you, but that requires modifying core javascript, outside of a template. A small change like this is probably harmless long term, but you may run into difficulties when discourse updates.

If someone with more insight than myself wants to chime in I’d listen to them.
