Pārlūkot izejas kodu

feat: search config

Carson 1 gadu atpakaļ
vecāks
revīzija
40311eadeb
2 mainītis faili ar 44 papildinājumiem un 6 dzēšanām
  1. 43 5
      .vitepress/config.mts
  2. 1 1
      .vitepress/theme/index.ts

+ 43 - 5
.vitepress/config.mts

@@ -105,11 +105,49 @@ export default defineConfig({
   title: "CocoBlockly帮助文档",
   description: "Cococlass help documents",
   srcDir: DOC_BASE_PATH,
-  // themeConfig: {
-  //   search: {
-  //     provider: "local",
-  //   },
-  // },
+  themeConfig: {
+    search: {
+      provider: "local",
+      options: {
+        locales: {
+          root: {
+            translations: {
+              button: {
+                buttonText: '搜索文档',
+                buttonAriaLabel: '搜索文档'
+              },
+              modal: {
+                noResultsText: '无法找到相关结果',
+                resetButtonTitle: '清除查询条件',
+                footer: {
+                  selectText: '选择',
+                  navigateText: '切换',
+                  closeText: '关闭',
+                }
+              }
+            }
+          },
+          'zh-HK': {
+            translations: {
+              button: {
+                buttonText: '搜索文档hk',
+                buttonAriaLabel: '搜索文档hk'
+              },
+              modal: {
+                noResultsText: '无法找到相关结果',
+                resetButtonTitle: '清除查询条件',
+                footer: {
+                  selectText: '选择',
+                  navigateText: '切换',
+                  closeText: '关闭',
+                }
+              }
+            }
+          }
+        }
+      }
+    },
+  },
   appearance: false,
 
   vite: {

+ 1 - 1
.vitepress/theme/index.ts

@@ -9,7 +9,7 @@ import "./style.css";
 
 export default {
   extends: DefaultTheme,
-  Layout: CustomLayout,
+  // Layout: CustomLayout,
   enhanceApp({ app, router, siteData }) {
     // NOTE polyfill `process` for library `path-browserify`,@SEE: https://github.com/browserify/path-browserify/issues/34
     if (!import.meta.env.SSR) {