Skip to content

Commit 1c37e61

Browse files
committed
docs: version dropdown
1 parent c8aa32f commit 1c37e61

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

docs/.vitepress/config.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import { defineConfig } from "vitepress";
2+
import { version } from "../../package.json";
3+
4+
const GTAG_ID = "G-GVYKBNTKPG";
5+
const vVersion = `v${version}`;
26

37
// https://vitepress.dev/reference/site-config
48
export default defineConfig({
@@ -43,6 +47,15 @@ export default defineConfig({
4347
{ text: "Guide", link: "/v1/guide" },
4448
{ text: "Examples", link: "/v1/examples" },
4549
{ text: "API", link: "/v1/api" },
50+
{
51+
text: vVersion,
52+
items: [
53+
{
54+
text: "Changelog",
55+
link: "https://github.com/phphe/he-tree-react/releases",
56+
},
57+
],
58+
},
4659
],
4760
},
4861
},
@@ -55,6 +68,15 @@ export default defineConfig({
5568
{ text: "使用", link: "/zh/v1/guide" },
5669
{ text: "例子", link: "/zh/v1/examples" },
5770
{ text: "API", link: "/zh/v1/api" },
71+
{
72+
text: vVersion,
73+
items: [
74+
{
75+
text: "更新日志",
76+
link: "https://github.com/phphe/he-tree-react/releases",
77+
},
78+
],
79+
},
5880
],
5981
},
6082
},
@@ -64,7 +86,7 @@ export default defineConfig({
6486
"script",
6587
{
6688
async: "",
67-
src: "https://www.googletagmanager.com/gtag/js?id=G-GVYKBNTKPG",
89+
src: `https://www.googletagmanager.com/gtag/js?id=${GTAG_ID}`,
6890
},
6991
],
7092
[
@@ -73,7 +95,7 @@ export default defineConfig({
7395
`window.dataLayer = window.dataLayer || [];
7496
function gtag(){dataLayer.push(arguments);}
7597
gtag('js', new Date());
76-
gtag('config', 'G-GVYKBNTKPG');`,
98+
gtag('config', '${GTAG_ID}');`,
7799
],
78100
],
79101
});

0 commit comments

Comments
 (0)