I’m trying to override site-header.hbs in my custom theme. The path in Discourse to that file is plugins/styleguide/assets/javascripts/discourse/components/sections/organisms/site-header.hbs.
I tried to add in my theme’s head_tag.html file:
<script type="text/x-handlebars" data-template-name="javascripts/components/sections/organisms/site-header">
<StyleguideExample @title="site header - in topic - scrolled">
<div class="d-header-wrap">
test
</div>
</StyleguideExample>
</script>
You’re trying to do something else for which you think overriding the template is the solution. Overriding templates is fragile and likely to cause issues down the road. What is it that you’re trying to do to the header that you can’t do with a plugin outlet?
@pfaffman thanks for your answer.
The main issue is that I need to keep all customizations in the theme and not in plugins. Is there another safer way to achieve this using the custom theme?
@pfaffman I want to remove the logo display, add a custom button. And above the header I want to display dynamic links which will come from a custom component.
@pfaffman thanks you. I totally understand your suggestions. However, I would like to know if there is a way to customize files, such as site-header.hbs through a custom theme. Does it make sense?
This theme-component might also be a consideration if your looking for header menu with dropdown submenu
Benefit of using an existing component (especially if official or from one of the partners) is that it will likely maintained with less chances of breakage.