From f342c5e22117ee4825d47d6710bdce6bdf41c05f Mon Sep 17 00:00:00 2001 From: MichaelSun Date: Fri, 27 Sep 2024 13:23:25 +0800 Subject: [PATCH] docs: add algolia search --- crawlerConfig.json | 33 ++++++++++++++++++++++++++++++++ docs/.vitepress/config.ts | 10 +++++----- docs/.vitepress/locales/zh-CN.ts | 7 +++++++ docs/.vitepress/theme/index.ts | 5 ++--- package.json | 2 +- 5 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 crawlerConfig.json diff --git a/crawlerConfig.json b/crawlerConfig.json new file mode 100644 index 00000000..5b75de63 --- /dev/null +++ b/crawlerConfig.json @@ -0,0 +1,33 @@ +{ + "index_name": "watermark-design", + "start_urls": ["https://watermark-design.github.io/watermark/"], + "rateLimit": 8, + "maxDepth": 10, + "selectors": { + "lvl0": { + "selector": "", + "defaultValue": "Documentation" + }, + "lvl1": ".content h1", + "lvl2": ".content h2", + "lvl3": ".content h3", + "lvl4": ".content h4", + "lvl5": ".content h5", + "content": ".content p, .content li", + "lang": { + "selector": "/html/@lang", + "type": "xpath", + "global": true + } + }, + "selectors_exclude": [ + "aside", + ".page-footer", + ".next-and-prev-link", + ".table-of-contents" + ], + "custom_settings": { + "attributesForFaceting": ["lang", "tags"] + }, + "js_render": true +} diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 047015be..db147091 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -82,11 +82,11 @@ export default { }, ], }, - // algolia: { - // appId: 'V6CF28P0PS', - // apiKey: '692752b7b3c6f794997d8ae22aed79fa', - // indexName: 'dev_docs' - // }, + algolia: { + appId: 'V6CF28P0PS', + apiKey: '692752b7b3c6f794997d8ae22aed79fa', + indexName: 'watermark-design', + }, footer: { message: 'Released under the MIT License.', copyright: 'Copyright © 2022-present Michael Sun', diff --git a/docs/.vitepress/locales/zh-CN.ts b/docs/.vitepress/locales/zh-CN.ts index 36027a06..3e144988 100644 --- a/docs/.vitepress/locales/zh-CN.ts +++ b/docs/.vitepress/locales/zh-CN.ts @@ -70,4 +70,11 @@ export default { footer: { message: '本中文文档内容版权为 Michael Sun 所有,保留所有权利。', }, + algolia: { + appId: 'V6CF28P0PS', + apiKey: '692752b7b3c6f794997d8ae22aed79fa', + indexName: 'watermark-design', + placeholder: '请输入关键词', + buttonText: '搜索', + }, }; diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 845e936d..991faa8f 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -1,4 +1,5 @@ import DefaultTheme from 'vitepress/theme'; +import ElementPlus from 'element-plus'; import './custom-theme.scss'; import 'element-plus/dist/index.css'; import 'element-plus/theme-chalk/dark/css-vars.css'; @@ -7,9 +8,7 @@ export default { enhanceApp: async ({ app, router, siteData, isServer }: any) => { // app is the Vue 3 app instance from `createApp()`. router is VitePress' // custom router. `siteData`` is a `ref`` of current site-level metadata. - import('element-plus').then((module) => { - app.use(module); - }); + app.use(ElementPlus); // import('@watermark-design/vue').then((module) => { // app.use(module.default); // }); diff --git a/package.json b/package.json index 9b866200..69c344ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "watermark-design", - "version": "1.0.0", + "version": "1.x", "private": true, "description": "watermark-design monorepo", "workspaces": [