Advanced Header Search

Looks like there was another update that needed to be installed. It’s working fine now. Thanks!

EDIT: Question - once a topic page is opened I noticed that the header search bar disappears and instead the regular search icon shows up next to the profile icon. Is that expected?

2 Likes

Yep, that is expected. We have to account for possible long titles in topics competing for room in the header.

1 Like

Hello

I’m having trouble understanding how to use the parameters.

Would it be possible to have an example?

An icon to launch a search in a specific category?

Thanks for your help.

Hi!

It seems like the shortcuts for search doesn’t work with this component.

image

Is it something intended? Can that be fixed?

1 Like

Hey @Stephane_Roy,

Sorry I didn’t see this earlier. From memory, Penar did most of the work on this, but I wrote the spec so can answer most of your questions about this functionality. Feel free to nudge me here if you have more questions :slight_smile:

Below is an example of what I did inside our Gitlab Category. You can see in our header search bar that as soon as we type a search term(in this case pipeline) you can search the gitlab forum(clicking comments button), the gitlab docs(book), the gitlab project(ticket), and gitlab python libraries.

image

Below is an example of the params which lets you search the gitlab forum.

params value
prefix https://forum.gitlab.com/
icon comments
target _blank
showInCategories 20,33,90

The Params, as far as I remember are

params value
prefix domain url with forward slash
icon name of the svg icon. You can use fontawesome icons, or custom icons
target
showInCategories list of category IDs which the icon should appear in
excludeFromCategories Show the icon in every category except this list of categories

:warning: use only one of either showInCategories or excludeFromCategories

Below is one of the related commits are from March to April 2023 give or take. The test case is a pretty good example too:
DEV: Add test case by pmusaraj · Pull Request #23 · discourse/discourse-header-search · GitHub

2 Likes