diff --git a/website/src/.vitepress/config.ts b/website/src/.vitepress/config.ts index 2cc257b6..37359cf8 100644 --- a/website/src/.vitepress/config.ts +++ b/website/src/.vitepress/config.ts @@ -1,3 +1,4 @@ +import { URL, fileURLToPath } from "node:url"; import { defineConfig, loadEnv } from "vitepress"; import ElementPlus from "unplugin-element-plus/vite"; @@ -32,6 +33,23 @@ export default defineConfig({ generateOgImages(context); }, vite: { + resolve: { + alias: [ + { + // Used to show the release version on navbar. + find: /^.*\/VPNavBarMenu\.vue$/, + replacement: fileURLToPath( + new URL("./theme/components/CustomNavBarMenu.vue", import.meta.url) + ), + }, + { + find: /^.*VPNavScreenMenu\.vue$/, + replacement: fileURLToPath( + new URL("./theme/components/CustomNavScreenMenu.vue", import.meta.url) + ), + }, + ] + }, plugins: [ElementPlus({})], ssr: { noExternal: ["element-plus"], diff --git a/website/src/.vitepress/config/navigation/navbar.ts b/website/src/.vitepress/config/navigation/navbar.ts index f53cf447..6c88e65d 100644 --- a/website/src/.vitepress/config/navigation/navbar.ts +++ b/website/src/.vitepress/config/navigation/navbar.ts @@ -1,7 +1,5 @@ import type { DefaultTheme } from "vitepress"; -const APP_VERSION = "0.14.6"; - const nav: DefaultTheme.NavItem[] = [ { text: "Documentation", @@ -9,7 +7,7 @@ const nav: DefaultTheme.NavItem[] = [ activeMatch: "/docs/", }, { - text: APP_VERSION, + text: "{app_version}", activeMatch: "^/*?(download|changelogs)/*?$", items: [ { @@ -18,7 +16,7 @@ const nav: DefaultTheme.NavItem[] = [ }, { text: "Changelog", - link: `/changelogs/#v${APP_VERSION}`, + link: "/changelogs/#v{app_version}", }, { text: "Contributing", diff --git a/website/src/.vitepress/theme/components/CustomNavBarMenu.vue b/website/src/.vitepress/theme/components/CustomNavBarMenu.vue new file mode 100644 index 00000000..8e7ec0ae --- /dev/null +++ b/website/src/.vitepress/theme/components/CustomNavBarMenu.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/website/src/.vitepress/theme/components/CustomNavScreenMenu.vue b/website/src/.vitepress/theme/components/CustomNavScreenMenu.vue new file mode 100644 index 00000000..a0a4d9b3 --- /dev/null +++ b/website/src/.vitepress/theme/components/CustomNavScreenMenu.vue @@ -0,0 +1,56 @@ + + +