搜索
参考文档:官方文档
minisearch
要启用此功能,只需在 .vitepress/config.ts
文件中将 themeConfig.search.provider
选项设置为 'local'
即可:
typescript
import {defineConfig} from 'vitepress'
export default defineConfig({
themeConfig: {
search: {
provider: 'local'
}
}
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
i18n
配置来使用多语言搜索,设置搜索的文本。
typescript
import { defineConfig } from 'vitepress'
export default defineConfig({
themeConfig: {
search: {
provider: 'local',
options: {
locales: {
zh: {
translations: {
button: {
buttonText: '搜索文档',
buttonAriaLabel: '搜索文档'
},
modal: {
noResultsText: '无法找到相关结果',
resetButtonTitle: '清除查询条件',
footer: {
selectText: '选择',
navigateText: '切换'
}
}
}
}
}
}
}
}
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29