diff --git a/packages/docs/docs/guide/frontmatter.md b/packages/docs/docs/guide/frontmatter.md index 1b3f0f5ce4..4e2654d779 100644 --- a/packages/docs/docs/guide/frontmatter.md +++ b/packages/docs/docs/guide/frontmatter.md @@ -49,13 +49,6 @@ lang = "en-US" Title of current page. -### tags - -- Type: `array` -- Default: `undefined` - -You can use tags to improve [built-in search](/theme/default-theme-config.html#built-in-search). - ### lang - Type: `string` @@ -137,3 +130,17 @@ See: [Default Theme Config > Prev / Next Links](../theme/default-theme-config.md - Default: `undefined` See: [Default Theme Config > Prev / Next Links](../theme/default-theme-config.md#prev-next-links). + +### search + +- Type: `boolean` +- Default: `undefined` + +See: [Default Theme Config > Built-in Search](../theme/default-theme-config.html#built-in-search). + +### tags + +- Type: `array` +- Default: `undefined` + +See: [Default Theme Config > Built-in Search](../theme/default-theme-config.html#built-in-search). diff --git a/packages/docs/docs/theme/default-theme-config.md b/packages/docs/docs/theme/default-theme-config.md index b335c3261d..ed2245efc0 100644 --- a/packages/docs/docs/theme/default-theme-config.md +++ b/packages/docs/docs/theme/default-theme-config.md @@ -349,26 +349,30 @@ module.exports = { } ``` -You can also disable the built-in search box for individual pages with `YAML front matter`: +You can improve the search result by [setting `tags` in frontmatter](../guide/frontmatter.md#tags): + ```yaml --- -search: false +tags: + - configuration + - theme + - indexing --- ``` -::: tip -Built-in Search only builds index from the title, `h2` and `h3` headers and any tags added with `YAML front matter` as shown below, if you need full text search, you can use [Algolia Search](#algolia-search). -::: +You can also disable the built-in search box for individual pages by [setting `search` in frontmatter](../guide/frontmatter.md#search): ```yaml --- -tags: - - configuration - - theme - - indexing +search: false --- ``` +::: tip +Built-in Search only builds index from the title, `h2` and `h3` headers and `tags`. +If you need full text search, you can use [Algolia Search](#algolia-search). +::: + ### Algolia Search The `themeConfig.algolia` option allows you to use [Algolia DocSearch](https://community.algolia.com/docsearch/) to replace the simple built-in search. To enable it, you need to provide at least `apiKey` and `indexName`: diff --git a/packages/docs/docs/zh/guide/frontmatter.md b/packages/docs/docs/zh/guide/frontmatter.md index 7806cae0ed..218dc1538f 100644 --- a/packages/docs/docs/zh/guide/frontmatter.md +++ b/packages/docs/docs/zh/guide/frontmatter.md @@ -107,25 +107,39 @@ meta: - 类型: `boolean` - 默认值: `undefined` -参考: [默认值 Theme Config > Disable the Navbar](../theme/default-theme-config.md#禁用导航栏). +参考: [默认主题配置 > 禁用导航栏](../theme/default-theme-config.md#禁用导航栏)。 ### sidebar - 类型: `boolean|'auto'` - 默认值: `undefined` -参考: [默认值 Theme Config > Sidebar](../theme/default-theme-config.md#侧边栏). +参考: [默认主题配置 > 侧边栏](../theme/default-theme-config.md#侧边栏)。 ### prev - 类型: `boolean|string` - 默认值: `undefined` -参考: [默认值 Theme Config > Prev / Next Links](../theme/default-theme-config.md#上-下一篇链接). +参考: [默认主题配置 > 上 / 下一篇链接](../theme/default-theme-config.md#上-下一篇链接)。 ### next - 类型: `boolean|string` - 默认值: `undefined` -参考: [默认值 Theme Config > Prev / Next Links](../theme/default-theme-config.md#上-下一篇链接). +参考: [默认主题配置 > 上 / 下一篇链接](../theme/default-theme-config.md#上-下一篇链接)。 + +### search + +- 类型: `boolean` +- 默认值: `undefined` + +参考: [默认主题配置 > 内置搜索](../theme/default-theme-config.md#内置搜索)。 + +### tags + +- 类型: `array` +- 默认值: `undefined` + +参考: [默认主题配置 > 内置搜索](../theme/default-theme-config.md#内置搜索)。 diff --git a/packages/docs/docs/zh/theme/default-theme-config.md b/packages/docs/docs/zh/theme/default-theme-config.md index 8365295dce..7a187775c5 100644 --- a/packages/docs/docs/zh/theme/default-theme-config.md +++ b/packages/docs/docs/zh/theme/default-theme-config.md @@ -345,7 +345,18 @@ module.exports = { } ``` -你可以通过 `YAML front matter` 来对单独的页面禁用内置的搜索框: +你可以通过[在页面的 frontmatter 中设置 `tags`](../guide/frontmatter.md#tags) 来优化搜索结果: + +```yaml +--- +tags: + - 配置 + - 主题 + - 索引 +--- +``` + +你可以通过[在页面的 frontmatter 中设置 `search`](../guide/frontmatter.md#search) 来对单独的页面禁用内置的搜索框: ```yaml --- @@ -354,7 +365,8 @@ search: false ``` ::: tip -内置搜索只会为页面的标题、`h2` 和 `h3` 构建搜索索引,如果你需要全文搜索,你可以使用 [Algolia 搜索](#Algolia-搜索)。 +内置搜索只会为页面的标题、`h2` 、 `h3` 以及 `tags` 构建搜索索引。 +如果你需要全文搜索,你可以使用 [Algolia 搜索](#algolia-搜索)。 ::: ### Algolia 搜索