Dumb question: do I want to make a theme, plugin or component?

I want to make some changes to the user card .hbs file:

https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/templates/components/user-card-contents.hbs

I can change this .hbs file but here’s what I can’t figure out: how exactly do I package it up in a way that it will be used in my Discourse? I can’t tell if needs to be part of a custom theme, or if I need to make a plugin (?!) or if I need to make a component (?!).

I am not asking someone else to do the work, and I’ve read up on how to develop themes and plugins and my head is swimming :wink: …I just need someone to “zoom out” a little bit and give me enough context and guidance so I can proceed.

2 Likes

You can create a new component directly from the discourse admin (in Customize) to override this file’s contents.

See: Developer’s guide to Discourse Themes

In your new component, go to Custom HTML/CSS, and in </head>, put this:

<script type="text/x-handlebars" data-template-name="components/user-card-contents">
//Here goes all user-card-contents template code
</script>
5 Likes

If all you want is to change the hbs file, a theme component is the way to go.

6 Likes

Thank you both so much!! This is exactly what I needed.

3 Likes