Search Banner

:discourse2: Summary Search Banner puts a search bar along with optional headline and subhead text in a banner above the main topic list navigation.
:eyeglasses: Preview Preview on Discourse Theme Creator
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-search-banner
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

Features

By default, this banner appears on all top-level topic pages (latest/new/unread/top/categories… anything in the top menu site setting) but it can also be set to only display on a community’s homepage.



Settings

Name Description
show on This determines which pages the banner appears
plugin outlet Where on the page the banner will appear
background image light Background image for the banner on light color palettes
background image dark Background image for the banner on dark color palettes
tile background image Repeat the background image
show for Who can see the Search Banner (logged in, logged out, or both)
special style Optional variations that change the appearance of the search banner
Translation Default
search_banner.headline Welcome to our community
search_banner.subhead We’re happy to have you here. If you need help, please search before you post.
search_banner.search_button_text

To omit one from display, leave the field blank.

Custom styling

The HTML element gets a class named .display-search-banner wherever this banner appears, and the banner itself is wrapped with the .custom-search-banner class, so with some CSS you should be able to customize the appearance of this banner however you see fit.

Future enhancements

  • Add an option to enable the banner in specific categories

Credits

:sparkling_heart: This very heavily borrows from @angusPavilion Header Search Theme Component


:discourse2: Hosted by us? Theme components are available to use on our Standard, Business, and Enterprise plans.

Last edited by @JammyDodger 2024-06-15T11:23:26Z

Check documentPerform check on document:
83 Likes

I’ve updated the theme component to add some new settings:

show on — this determines where the banner appears and has the options

  • top_menu (latest/categories/top/new/unread)
  • homepage
  • all (all pages except the default search page and admin pages)

show for — this determines who sees the banner

  • everyone
  • logged_in
  • logged_out
16 Likes

I’ve just made a minor update that adds an optional style to this component, it gets you a large search bar without title text:

This can be enabled by a new “special style” setting. All this does is enable a little additional CSS.


I may add some more options here in the future as well!

7 Likes

How do I change the color of the Welcome text in this add-on?

1 Like

There is no setting for that. However, you can add just it with some CSS:

Add the following to your theme or a new theme component, and change as you wish. :+1:

.search-banner > .custom-search-banner  {
    /* title */
    h1 {
        color: #286989;
    }
    
    /* description */
    p {
        color: #286989
    }
}
3 Likes

TY very much!

2 Likes

Is there a way to hide the search icon (using CSS or otherwise)? I’m having an issue where the search icon is being duplicated when used in conjunction with this component: Header Search - #56 by RBoy

1 Like
.search-input .search-icon:first-child {
  display: none;
}

should only display one search icon. I will say though, using the search banner and header search in tangent has some bad UX side effects.

I would reccomend just using one or the other.

4 Likes

Thanks! Super helpful

Could you elaborate, what UX side effects?

1 Like

The video I linked above shows a few of the issues :slight_smile:

  • overlapping search dropdowns
  • odd open and closed states of search dropdowns
  • search icon is a link to advanced search in one search input and not in the other
  • etc
2 Likes

Got it. So as long as they aren’t together on the same page it should be fine.

2 Likes

Can someone help me? I installed this theme on my Discourse but the image is cutting off a piece on the right side, for the image to fit completely I have to set the site’s font to “Smaller” I have two different installations of Discourse and in one of them the image worked normally, in the other the image why is it cut off?

2 Likes

can you include a screenshot? this will make it much easier to understand the issue

2 Likes

i have the same problem that different browsers/modes show different parts of that image. I solved it by making it extra wide, so the right side only shows in some conditions. But thats not so easy for symmetric images. I guess some more CSS (without searching for a thome-component-overwrite) would help with that.

I managed to solve part of it, I disabled the theme component in the other themes and left it only at 1, incredible as it seems, the image was “normal” with the font size at “normal” only because of the cell phone that only one side of the image appears, will it be Is there anything I can do to make it appear completely on my cell phone too?

hi!
I think something happened with this component, so in admin it won’t let me add background image(

1 Like

if you recently updated the component, you may just need to refresh the page and try again?

5 Likes

yep, it worked
thanks!

1 Like

Hi,

Is there a way to remove the spacing b/w the search banner and header?

1 Like

Hi, you can use this CSS in a new theme component:

.custom-search-banner-wrap {
    margin-top: 0;
}
3 Likes