Last updated

search

By default, search is added to your project in the top navigation bar in the far right side corner. You can use the search configuration to customize search in the following ways:

  • hide the search bar
  • add a list of shortcuts for activating search
  • add a list of suggested pages to the search modal
  • use fuzzy search

Options

OptionTypeDescription
hidebooleanSpecifies if the search bar should be hidden. Default: false.
shortcuts[string]List of keyboard shortcuts to activate search (for example, ctrl+f). Default: /.
suggestedPages[Page item]List of suggested pages.
fuzzybooleanSpecifies whether to use fuzzy search. Fuzzy search finds close rather than only exact matches. This type of search helps by using more relaxed search terms and displaying more results. Default: false.
facets[Facet item]List of user-defined search facets.

Page item object

OptionTypeDescription
pagestringREQUIRED. Path to the file which represents the page to link to.
labelstringLink text displayed for the item.
labelTranslationKeystringLink text key for the item used for localization.

Facet item object

OptionTypeDescription
namestringREQUIRED. Name of the facet. It also acts as a label for the filtering control in the search dialog.
fieldstringREQUIRED. The ID of the facet. This is what you use as a key in metadata section when adding facets to the page.
typestringREQUIRED. Type of control that will be displayed in the search dialog. The possible values are: input, multi-select, select, operation, switch, radio, checkbox.

Examples

The following configuration hides the search bar.

search:
  hide: true

The following configuration sets keyboard shortcuts that trigger search:

search:
  shortcuts:
    - ctrl+f
    - cmd+k
    - /

The following configuration sets suggested pages for the search modal window:

search:
  suggestedPages:
    - label: Home page
      page: index.page.tsx
    - page: /catalog/

The following configuration defines custom/overrides existing search facets:

search:
  facetsConfig:
    - name: 'HTTP Method'
      field: 'httpMethod'
      type: 'tags'
    - name: 'HTTP Path'
      field: 'httpPath'
      type: 'multi-select'
    - name: 'API Title'
      field: 'apiTitle'
      type: 'multi-select'
    - name: 'API Version'
      field: 'apiVersion'
      type: 'select'

  • Learn more about the options for adding translated content in the l10n reference documentation.
  • Find other options for adding items to the top navigation menu in the navbar reference documentation.

Resources