feat: show git commit reference in documents footer

This commit is contained in:
Hintay 2023-05-06 20:26:57 +08:00
parent efda5a84dc
commit 2831208de3
No known key found for this signature in database
GPG key ID: 120FC7FF121F2F2D
7 changed files with 33 additions and 8 deletions

View file

@ -0,0 +1,3 @@
export const projectUrl: string = "https://github.com/0xJacky/nginx-ui"
export const demoUrl: string = "https://demo.nginxui.com"
export const editLinkPattern: string = projectUrl + '/edit/master/docs/:path'

View file

@ -1,11 +1,12 @@
import {LocaleSpecificConfig, DefaultTheme} from "vitepress"
import {demoUrl} from './common'
export const enConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
themeConfig: {
nav: [
{text: 'Home', link: '/'},
{text: 'Guide', link: '/guide/about'},
{text: 'Demo', link: 'https://demo.nginxui.com'}
{text: 'Demo', link: demoUrl}
],
sidebar: {

View file

@ -1,4 +1,9 @@
import { defineConfig } from 'vitepress'
import {projectUrl, editLinkPattern} from './common'
export const commitRef = process.env.COMMIT_REF ?
`<a href="${projectUrl}/commit/${process.env.COMMIT_REF}">` + process.env.COMMIT_REF.slice(0, 8) + '</a>':
'dev'
function thisYear() {
return new Date().getFullYear()
@ -8,6 +13,11 @@ export const sharedConfig = defineConfig({
title: 'Nginx UI',
description: 'Yet another Nginx Web UI',
head: [
['link', { rel: 'icon', type: 'image/svg+xml', href: '/assets/logo.svg' }],
['meta', { name: 'theme-color', content: '#3682D8' }]
],
lastUpdated: true,
themeConfig: {
@ -18,16 +28,16 @@ export const sharedConfig = defineConfig({
},
editLink: {
pattern: 'https://github.com/0xJacky/nginx-ui/edit/master/docs/:path'
pattern: editLinkPattern
},
footer: {
message: 'Released under the AGPL-3.0 License.',
message: `Released under the AGPL-3.0 License. (${commitRef})`,
copyright: 'Copyright © 2021-' + thisYear() + ' Nginx UI Team'
},
socialLinks: [
{icon: 'github', link: 'https://github.com/0xJacky/nginx-ui'}
{icon: 'github', link: projectUrl}
]
}
})

View file

@ -1,16 +1,17 @@
import {LocaleSpecificConfig, DefaultTheme} from "vitepress"
import {demoUrl, editLinkPattern} from './common'
export const zhCNConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
themeConfig: {
nav: [
{text: '首页', link: '/zh_CN/'},
{text: '手册', link: '/zh_CN/guide/about'},
{text: '演示', link: 'https://demo.nginxui.com'}
{text: '演示', link: demoUrl}
],
editLink: {
text: '编辑此页',
pattern: 'https://github.com/0xJacky/nginx-ui/edit/master/docs/:path'
pattern: editLinkPattern
},
sidebar: {

View file

@ -10,6 +10,8 @@
"vitepress": "^1.0.0-alpha.75"
},
"devDependencies": {
"@types/node": "^20.1.0",
"less": "^4.1.3"
}
},
"license": "AGPL-3.0"
}

View file

@ -427,6 +427,13 @@ __metadata:
languageName: node
linkType: hard
"@types/node@npm:^20.1.0":
version: 20.1.0
resolution: "@types/node@npm:20.1.0"
checksum: c6d9afa9aa78b4b4348c69ece94975be70346b144c278f1395694a10ef919d7db300018101b6f9245e6bdd76674a5327d2d14829092f3d5295e858cff5f22a66
languageName: node
linkType: hard
"@types/web-bluetooth@npm:^0.0.17":
version: 0.0.17
resolution: "@types/web-bluetooth@npm:0.0.17"
@ -1448,6 +1455,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "nginx-ui-docs@workspace:."
dependencies:
"@types/node": ^20.1.0
less: ^4.1.3
vitepress: ^1.0.0-alpha.75
languageName: unknown