Is there a way to show a different main logo in the header (top left) when browsing threads within a certain category or their sub categories? Thank you.
סיכום מבוסס בינה מלאכותית
Discourse users are discussing how to show different logos based on categories. Qursch suggests using the body’s class category-{category} to apply category-specific CSS. Canapin proposes using JavaScript to change the logo image based on the category.
Alternatively, bangkarlsen provides a CSS solution using the body.category- class to hide the regular site logo and display a custom image in the title. nolo points out the need to apply the image to the <a> element to prevent the logo link from collapsing. bangkarlsen acknowledges this correction, ensuring a working solution.
I believe the body includes a class category-{category here}, which you could use to change category specific CSS.
I don’t know how to execute a script after the page content have loaded (I’m interested to know that too!), but for changing the logo image, you could do this:
// in a condition like if category == "somecategory" then…
document.getElementById("#site-logo").src = settings.theme_uploads.logo_cat1;
where logo_cat1 is the variable name of a custom logo:

I recently had this problem also. I realise this is an old topic, but here’s a solution in case someone comes by.
You can use CSS and utilize the classes on the body element to detect which category you are in.
// Dont show regular site logo
body.category-something #site-logo {
display: none;
}
// Show another image in the title
body.category-something .home-logo-wrapper-outlet {
height: 50px;
width: 100px;
background-image: url($category-something-image);
}
Hope that makes sense ![]()
I think you’d need to put your image on the <a> element, else the logo link will just collapse.
// Show another image in the title
body.category-something .d-header .title a {
...
}
Ah, right, I was mostly focussing on the CSS selectors. Thanks for correcting that.