How to change category names via theme-component

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.

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

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

2 Likes

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:

You can use this theme component to get an idea of where you can input things to your site:

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

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

Overriding this function to something like

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.

3 Likes