内容搜索
约 289 字小于 1 分钟
2024-03-06
本地搜索
概述
为站点添加本地搜索。
功能说明请参考 搜索功能
关联插件: @vuepress-plume/plugin-search
默认配置:
.vuepress/config.ts
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'
export default defineUserConfig({
theme: plumeTheme({
search: {
provider: 'local',
// more options...
},
})
})关于配置入口的优先级说明,请参考 插件配置入口。
配置
interface SearchOptions {
/**
* 本地搜索 国际化
*/
locales?: {
[locale: string]: SearchBoxLocale
}
/**
* 文章是否可被搜索,默认为 `() => 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
概述
使用 Algolia DocSearch 提供支持的网站内容搜索插件
关联插件:@vuepress/plugin-docsearch
查看 Algolia DocSearch 参考(在新窗口打开) 获取更多信息。
启用
.vuepress/config.ts
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'
export default defineUserConfig({
theme: plumeTheme({
search: {
provider: 'algolia',
appId: 'YOUR_APP_ID',
apiKey: 'YOUR_API_KEY',
indexName: 'YOUR_INDEX_NAME',
// more options
},
})
})关于配置入口的优先级说明,请参考 插件配置入口。
贡献者
更新日志
2026/7/15 13:40
查看所有更新日志
0daf2-docs: improve docs (#929)于aede6-fix(theme): twoslash comment error (#881)于4d236-feat(theme)!: add collections support (#704)于74dfa-docs: enable twoslash for code block于0fd6c-refactor(theme): improve types and flat config (#524)于0c53b-docs: improve docs (#332)于b079a-docs: update docs于2fb3d-docs: update theme docs于ca097-docs: lint fix于c56ba-feat: 全新的文档!于
