From 0a310e532766d634ae8bb8580d5e002de4329b5f Mon Sep 17 00:00:00 2001 From: wizardchen Date: Thu, 6 Aug 2026 20:04:47 +0800 Subject: [PATCH] docs(website): add official site link and inject VERSION at build time Read the repo VERSION file for footer and landing hero labels, and add navigation to https://weknora.weixin.qq.com from the docs site. --- website-docs/.vitepress/config.mts | 8 +++++++- website-docs/.vitepress/theme-config.d.ts | 8 ++++++++ website-docs/.vitepress/theme/Landing.vue | 14 +++++++++++++- website-docs/.vitepress/version.ts | 15 +++++++++++++++ website-docs/README.md | 2 +- 5 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 website-docs/.vitepress/theme-config.d.ts create mode 100644 website-docs/.vitepress/version.ts diff --git a/website-docs/.vitepress/config.mts b/website-docs/.vitepress/config.mts index acdb2037..85b3a90c 100644 --- a/website-docs/.vitepress/config.mts +++ b/website-docs/.vitepress/config.mts @@ -2,6 +2,8 @@ import { readFileSync, readdirSync } from 'node:fs' import { resolve } from 'node:path' import { defineConfig, type DefaultTheme } from 'vitepress' import { withMermaid } from 'vitepress-plugin-mermaid' +import './theme-config.d.ts' +import { repoVersionLabel } from './version' const root = resolve(import.meta.dirname, '..') @@ -56,6 +58,7 @@ function tokenize(text: string): string[] { } const repo = 'https://github.com/Tencent/WeKnora' +const site = 'https://weknora.weixin.qq.com' export default withMermaid( defineConfig({ @@ -106,8 +109,11 @@ export default withMermaid( { text: 'API', link: '/04-api/01-api-overview', activeMatch: '/04-api/' }, { text: '客户端', link: '/05-clients/01-frontend', activeMatch: '/05-clients/' }, { text: '开发', link: '/06-development/01-dev-guide', activeMatch: '/06-development/' }, + { text: '官网', link: site }, ], + weknoraVersion: repoVersionLabel, + sidebar, socialLinks: [{ icon: 'github', link: repo }], @@ -160,7 +166,7 @@ export default withMermaid( }, footer: { - message: '基于 WeKnora main 分支源码整理 · MIT License', + message: `基于 WeKnora ${repoVersionLabel} 源码整理 · MIT License`, copyright: '© Tencent WeKnora', }, }, diff --git a/website-docs/.vitepress/theme-config.d.ts b/website-docs/.vitepress/theme-config.d.ts new file mode 100644 index 00000000..241b1c8a --- /dev/null +++ b/website-docs/.vitepress/theme-config.d.ts @@ -0,0 +1,8 @@ +import 'vitepress' + +declare module 'vitepress/dist/client/theme-default/config' { + export interface ThemeConfig { + /** 文档站点展示的 WeKnora 发布版本(来自仓库根 VERSION) */ + weknoraVersion?: string + } +} diff --git a/website-docs/.vitepress/theme/Landing.vue b/website-docs/.vitepress/theme/Landing.vue index e78367ac..08bcbcaa 100644 --- a/website-docs/.vitepress/theme/Landing.vue +++ b/website-docs/.vitepress/theme/Landing.vue @@ -1,6 +1,10 @@