Skip to content

Commit 2831208

Browse files
committed
feat: show git commit reference in documents footer
1 parent efda5a8 commit 2831208

File tree

7 files changed

+33
-8
lines changed

7 files changed

+33
-8
lines changed

.github/workflows/documents.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
working-directory: docs
4141

4242
- name: Build
43-
run: yarn docs:build
43+
run: COMMIT_REF=$(git rev-parse HEAD) yarn docs:build
4444
working-directory: docs
4545

4646
- name: Archive artifacts

docs/.vitepress/config/common.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const projectUrl: string = "https://github.com/0xJacky/nginx-ui"
2+
export const demoUrl: string = "https://demo.nginxui.com"
3+
export const editLinkPattern: string = projectUrl + '/edit/master/docs/:path'

docs/.vitepress/config/en.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import {LocaleSpecificConfig, DefaultTheme} from "vitepress"
2+
import {demoUrl} from './common'
23

34
export const enConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
45
themeConfig: {
56
nav: [
67
{text: 'Home', link: '/'},
78
{text: 'Guide', link: '/guide/about'},
8-
{text: 'Demo', link: 'https://demo.nginxui.com'}
9+
{text: 'Demo', link: demoUrl}
910
],
1011

1112
sidebar: {

docs/.vitepress/config/shared.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import { defineConfig } from 'vitepress'
2+
import {projectUrl, editLinkPattern} from './common'
3+
4+
export const commitRef = process.env.COMMIT_REF ?
5+
`<a href="${projectUrl}/commit/${process.env.COMMIT_REF}">` + process.env.COMMIT_REF.slice(0, 8) + '</a>':
6+
'dev'
27

38
function thisYear() {
49
return new Date().getFullYear()
@@ -8,6 +13,11 @@ export const sharedConfig = defineConfig({
813
title: 'Nginx UI',
914
description: 'Yet another Nginx Web UI',
1015

16+
head: [
17+
['link', { rel: 'icon', type: 'image/svg+xml', href: '/assets/logo.svg' }],
18+
['meta', { name: 'theme-color', content: '#3682D8' }]
19+
],
20+
1121
lastUpdated: true,
1222

1323
themeConfig: {
@@ -18,16 +28,16 @@ export const sharedConfig = defineConfig({
1828
},
1929

2030
editLink: {
21-
pattern: 'https://github.com/0xJacky/nginx-ui/edit/master/docs/:path'
31+
pattern: editLinkPattern
2232
},
2333

2434
footer: {
25-
message: 'Released under the AGPL-3.0 License.',
35+
message: `Released under the AGPL-3.0 License. (${commitRef})`,
2636
copyright: 'Copyright © 2021-' + thisYear() + ' Nginx UI Team'
2737
},
2838

2939
socialLinks: [
30-
{icon: 'github', link: 'https://github.com/0xJacky/nginx-ui'}
40+
{icon: 'github', link: projectUrl}
3141
]
3242
}
3343
})

docs/.vitepress/config/zh_CN.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import {LocaleSpecificConfig, DefaultTheme} from "vitepress"
2+
import {demoUrl, editLinkPattern} from './common'
23

34
export const zhCNConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
45
themeConfig: {
56
nav: [
67
{text: '首页', link: '/zh_CN/'},
78
{text: '手册', link: '/zh_CN/guide/about'},
8-
{text: '演示', link: 'https://demo.nginxui.com'}
9+
{text: '演示', link: demoUrl}
910
],
1011

1112
editLink: {
1213
text: '编辑此页',
13-
pattern: 'https://github.com/0xJacky/nginx-ui/edit/master/docs/:path'
14+
pattern: editLinkPattern
1415
},
1516

1617
sidebar: {

docs/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
"vitepress": "^1.0.0-alpha.75"
1111
},
1212
"devDependencies": {
13+
"@types/node": "^20.1.0",
1314
"less": "^4.1.3"
14-
}
15+
},
16+
"license": "AGPL-3.0"
1517
}

docs/yarn.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,13 @@ __metadata:
427427
languageName: node
428428
linkType: hard
429429

430+
"@types/node@npm:^20.1.0":
431+
version: 20.1.0
432+
resolution: "@types/node@npm:20.1.0"
433+
checksum: c6d9afa9aa78b4b4348c69ece94975be70346b144c278f1395694a10ef919d7db300018101b6f9245e6bdd76674a5327d2d14829092f3d5295e858cff5f22a66
434+
languageName: node
435+
linkType: hard
436+
430437
"@types/web-bluetooth@npm:^0.0.17":
431438
version: 0.0.17
432439
resolution: "@types/web-bluetooth@npm:0.0.17"
@@ -1448,6 +1455,7 @@ __metadata:
14481455
version: 0.0.0-use.local
14491456
resolution: "nginx-ui-docs@workspace:."
14501457
dependencies:
1458+
"@types/node": ^20.1.0
14511459
less: ^4.1.3
14521460
vitepress: ^1.0.0-alpha.75
14531461
languageName: unknown

0 commit comments

Comments
 (0)