Redirect search icon to search page

AI-generated summary

The discussion revolves around redirecting the search icon to a search page. VaypeNaysh420 is looking for a way to achieve this, considering using a custom icon header component or a link to hide the default icon with CSS. However, nolo suggests this approach and also recommends customizing the expanded search view or directing to a custom Docs page.

Johani cautions against redirecting the search icon, highlighting the benefits of the default context-aware search panel, which allows users to search within specific contexts (e.g., categories, tags, topics) and provides a more nuanced search experience. Redirecting to /search would require users to manually input or select search options, potentially losing the benefits of the default search panel.

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.

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.