From c7189694bae287eb606d9d00db452da19e087030 Mon Sep 17 00:00:00 2001 From: Yanjin Li Date: Fri, 6 Sep 2024 18:36:32 +0800 Subject: [PATCH] add local search feature --- docs/.vitepress/config/theme.ts | 47 +++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/docs/.vitepress/config/theme.ts b/docs/.vitepress/config/theme.ts index 6c13a94..9fb02d2 100644 --- a/docs/.vitepress/config/theme.ts +++ b/docs/.vitepress/config/theme.ts @@ -1,11 +1,50 @@ import type { DefaultTheme } from "vitepress/theme-without-fonts"; -import algolia from "./algolia"; import { LOGO as logo, REPO } from "./info"; import nav from "./nav"; import sidebar from "./sidebar"; const themeConfig: DefaultTheme.Config = { - algolia, + // algolia, + search: { + provider: "local", + options: { + locales: { + root: { + translations: { + button: { + buttonText: "搜索", + buttonAriaLabel: "搜索", + }, + modal: { + displayDetails: "显示详细列表", + resetButtonTitle: "重置搜索", + backButtonTitle: "关闭搜索", + noResultsText: "没有结果", + footer: { + selectText: "选择", + selectKeyAriaLabel: "输入", + navigateText: "导航", + navigateUpKeyAriaLabel: "上箭头", + navigateDownKeyAriaLabel: "下箭头", + closeText: "关闭", + closeKeyAriaLabel: "esc", + }, + }, + }, + }, + }, + }, + }, + darkModeSwitchLabel: "颜色选择", + lightModeSwitchTitle: "切换至亮色模式", + darkModeSwitchTitle: "切换至暗色模式", + sidebarMenuLabel: "目录", + returnToTopLabel: "回到顶部", + externalLinkIcon: true, + outline: { + label: "目录", + level: [1, 5], + }, editLink: { pattern: `${REPO}/edit/main/docs/:path`, text: "在 GitHub 上编辑此页", @@ -15,6 +54,10 @@ const themeConfig: DefaultTheme.Config = { 'Availably free under CC BY-SA 4.0.', copyright: `Made with ❤️️ by all contributors.`, }, + docFooter: { + prev: "上一节", + next: "下一节", + }, lastUpdatedText: "📑 最后更新", logo, nav,