Image header depending on the category/tab

AI-generated summary

DavidGNavas inquired about implementing category-specific header images on a Discourse forum, similar to examples seen on the Smartthings and hairxhub forums, where images appear only when users visit specific tabs or categories. sigurdur explained that this effect is achieved through CSS by setting the background image on the body element, utilizing category-specific classes (e.g., body.category-hairstyles). He provided a link to the hairxhub CSS file as a reference. DavidGNavas expressed relief that the solution involves standard CSS customization rather than complex Ember.js hacks. sigurdur later updated the discussion, noting a more direct method within Discourse to add background images for specific categories, referencing a relevant Meta discussion thread.

As seen on Smartthings forum and hairxhub, you can add an image on the header depending on the tab or the category the user is in.

For example, if the user enters in forum.com/c/examples, he can view the image on the header, but not in all the other tabs/category, nor in the main homepage.

Does someone know how to do this? We can pay for this customization if there is someone interested.

Thanks!

This is pretty cool …

The way they do it is by adding CSS to their site.

They tie the image to the body as a background image.

They use this css as base
https://hairxhub.com/hair-talk-forum-css/style.css

Then they add custom CSS for each of their categories to display a different image..
(or in CSS terms)

body.category-hairstyles { background-image: url(/some-image.jpg); }

So if you’re comfortable with CSS, you can hack this on your own :wink:

4 Mi Piace

Thanks @sigurdur!

I thought they had done some ember.js hack, if it is only a CSS customiz. we can do it :smile:

Very kind of you :sunny:

Hah .. seems like I have some things to learn about discourse ..!

You can add background images directly for a category .. you can see how here:
https://meta.discourse.org/t/give-discourse-social-media-look/23711/77?u=sigurdur

1 Mi Piace

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.