pengzhanbo 385059f214
docs: update en docs (#708)
* docs: update en docs

* chore: tweak

* chore: tweak

* chore: tweak
2025-10-09 15:46:05 +08:00

2.3 KiB

title, createTime, permalink
title createTime permalink
Content Search 2025/10/09 09:19:26 /en/config/plugins/search/

Overview

Adds local search functionality to the site.

Related plugin: @vuepress-plume/plugin-search

This plugin uses minisearch for content search.

Default configuration:

import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'

export default defineUserConfig({
  theme: plumeTheme({
    search: {
      provider: 'local', // [!code hl]
      // more options...
    },
    // Can also be configured via plugins.search, but not recommended
    plugins: {
      search: {},
    }
  })
})

Configuration

interface SearchOptions {
  /**
   * Local search internationalization
   */
  locales?: {
    [locale: string]: SearchBoxLocale
  }

  /**
   * Whether articles are searchable, defaults to `() => true`
   */
  isSearchable?: (page: Page) => boolean
}

interface SearchBoxLocale {
  placeholder: string
  buttonText: string
  resetButtonTitle: string
  backButtonTitle: string
  noResultsText: string
  footer: {
    selectText: string
    selectKeyAriaLabel: string
    navigateText: string
    navigateUpKeyAriaLabel: string
    navigateDownKeyAriaLabel: string
    closeText: string
    closeKeyAriaLabel: string
  }
}

Algolia DocSearch

Overview

A site content search plugin powered by Algolia DocSearch

Related plugin: @vuepress/plugin-docsearch

Refer to Algolia DocSearch Reference for more information.

Enable

import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'

export default defineUserConfig({
  theme: plumeTheme({
    search: {
      provider: 'algolia', // [!code hl]
      appId: 'YOUR_APP_ID',
      apiKey: 'YOUR_API_KEY',
      indexName: 'YOUR_INDEX_NAME',
      // more options
    },
    // Can also be configured via plugins.docsearch, but not recommended
    plugins: {
      docsearch: {},
    }
  })
})