Advanced Header Search

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