From ef08d77f45c01c0a6cedadf322ae032d85f8f987 Mon Sep 17 00:00:00 2001 From: zerolee <464806884@qq.com> Date: Wed, 13 Dec 2023 17:10:01 +0800 Subject: [PATCH] change version name --- .vitepress/config.mts | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 32deb48b..c6fb6fa1 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -43,14 +43,19 @@ const { current, branches } = branchInfo; const isMain = current === 'main'; const base = isMain ? '/' : `/${current}/`; const domain = 'https://docs.deepwisdom.ai'; -const versions = Object.keys(branches).reduce((vs, branchname) => { - const regex = /^remotes\/origin\/(v.*)$/; - const [, remotebn] = regex.exec(branchname) || []; - if (remotebn && remotebn !== current) { - vs.push(remotebn); - } - return vs; -}, [] as string[]); +const versions = Object.keys(branches) + .reduce((vs, branchname) => { + const regex = /^remotes\/origin\/(v.*)$/; + const [, remotebn] = regex.exec(branchname) || []; + if (remotebn) { + vs.push(remotebn); + } + return vs; + }, [] as string[]) + .sort() + .reverse(); + +versions[0] += ' (stable)'; const getVersions = () => { if (!versions.length && isMain) { @@ -60,9 +65,12 @@ const getVersions = () => { { text: current, items: [ - ...(!isMain - ? [{ text: 'latest', link: `${domain}`, target: '_blank' }] - : []), + { + text: 'main (unstable)', + link: `${domain}`, + target: '_blank', + disabled: true, + }, ...versions.map((v) => ({ text: v, link: `${domain}/${v}/`,