Redirect search icon to search page

Might you know of a quick and easy way to make it so when someone clicks the search icon, instead of having that input field popup, visitor will be redirected to discourse.local/search?expanded=true?

You think it would be best if I just used a component custom icon header or link and used CSS to hide that icon?

Not sure if that’s the quickest/easiest/best way, but, yes, that’s what I did so far in case:

  • hide the default icon with css
  • add a custom icon with the icon-header-links component
  • link that icon to your custom page

Though I’d combine it with either customizing the expanded search view. Or actually directing to a custom Docs page.

2 Likes

Are you sure you want to do that?

The search panel is context-aware. So, it gives your users a much more nuanced search experience.

  • Search for user posts when on a user page
  • Search in category when on a category page
  • Search in tag when on a tag page
  • Search in topic when on a topic page

It also gives them an option to search globally on all of those pages.

Making the search icon redirect to /search means that you lose all of that unless users input that information manually or select them in the full page search options.

2 Likes