Adding Custom Code to Header


(Hexa) #1

How can I reference resources for code for a custom header on Discouse? I would like to add a menu above the existing top bar. Can I upload CSS, JS, HTML somehow? Also, do I upload the HTML in the head or /header section?


(Erlend Sogge Heggen) #2

There’s plenty of guides on this:

https://meta.discourse.org/search?q=%23howto%20header


(Hexa) #3

Thank you! I will read the article and let you know if I have any questions. :slight_smile:


(Hexa) #4

Where do I upload the css, stylesheets, etc?


(cpradio) #5

Admin > Customize > Themes


(Hexa) #6

Do I go into an existing theme?


(cpradio) #7

You can, or you can create a new one and treat it as a component, then add that component to an existing theme.


(Hexa) #8

How do I do that? Can you walk me through it or is there an article on Meta?


(cpradio) #9

I’m not sure what you are struggling with.

  1. Visit Admin > Customize > Themes
  2. Click New
  3. Click Pencil Icon to give it a name
  4. Click Edit CSS/HTML (enter what you need)
  5. Click on the active theme (the one with the asterisk)
  6. There is likely a drop down of components you can add, find your newly added one and click the Add button
  • If there isn’t, check the box permiting the theme to have child themes.

(Hexa) #10

So, I just add the content in the new theme and add it as a child theme? Where do I add the CSS and what section does JS go?


(cpradio) #11

Following that search link from @erlend_sh should help you out with that part :wink: