Skip to content

Commit

Permalink
change version name
Browse files Browse the repository at this point in the history
  • Loading branch information
zerolee1231 committed Dec 13, 2023
1 parent 6776e5a commit ef08d77
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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}/`,
Expand Down

0 comments on commit ef08d77

Please sign in to comment.