1- import { createWriteStream } from 'node:fs'
2- import { resolve } from 'node:path'
3- import { SitemapStream } from 'sitemap'
4- import { defineConfig } from 'vitepress'
1+ import { createWriteStream } from 'node:fs' ;
2+ import { resolve } from 'node:path' ;
3+ import { SitemapStream } from 'sitemap' ;
4+ import { defineConfig } from 'vitepress' ;
5+
6+ const links : { url : string ; lastmod : number } [ ] = [ ] ;
57
6- const links = [ ]
78export default defineConfig ( {
89 lastUpdated : true ,
910 lang : 'zh-CN' ,
1011 transformHtml : ( _ , id , { pageData } ) => {
1112 if ( ! / [ \\ / ] 4 0 4 \. h t m l $ / . test ( id ) ) {
1213 links . push ( {
1314 url : pageData . relativePath . replace ( / \/ i n d e x \. m d $ / , '/' ) . replace ( / \. m d $ / , '.html' ) ,
14- lastmod : pageData . lastUpdated ,
15- } )
15+ lastmod : pageData . lastUpdated ?? Date . now ( ) ,
16+ } ) ;
1617 }
1718 } ,
1819 buildEnd : async ( { outDir } ) => {
1920 const sitemap = new SitemapStream ( {
2021 hostname : 'https://www.spiritlhl.net/'
21- } )
22- const writeStream = createWriteStream ( resolve ( outDir , 'sitemap.xml' ) )
23- sitemap . pipe ( writeStream )
24- links . forEach ( ( link ) => sitemap . write ( link ) )
25- sitemap . end ( )
26- await new Promise ( ( r ) => writeStream . on ( 'finish' , r ) )
22+ } ) ;
23+ const writeStream = createWriteStream ( resolve ( outDir , 'sitemap.xml' ) ) ;
24+ sitemap . pipe ( writeStream ) ;
25+ links . forEach ( ( link ) => sitemap . write ( link ) ) ;
26+ sitemap . end ( ) ;
27+ await new Promise ( ( r ) => writeStream . on ( 'finish' , r ) ) ;
2728 } ,
2829 head : [
29- [ 'link' , { rel : 'icon' , href : 'https://raw.githubusercontent.com/spiritlhls/pages/main/logo.png' } ] ,
30+ [ 'link' , { rel : 'icon' , href : 'https://cdn.spiritlhl.net/https:// raw.githubusercontent.com/spiritlhls/pages/main/logo.png' } ] ,
3031 [ 'meta' , { name : 'google-site-verification' , content : 'wdrGBim_2XmtMrqxivze70saMiPQAiOhpmN3KAWb0Sw' } ] ,
31- // <meta name="google-site-verification" content="wdrGBim_2XmtMrqxivze70saMiPQAiOhpmN3KAWb0Sw" />
3232 [ 'meta' , { name : 'msvalidate.01' , content : 'FC9B6B8BEB3D3B56844ADA69766DBB24' } ] ,
33- // <meta name="msvalidate.01" content="FC9B6B8BEB3D3B56844ADA69766DBB24" />
3433 [ 'script' , {
35- async : true ,
3634 src : "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5991535488582679" ,
3735 crossorigin : "anonymous"
3836 } ] ,
3937 ] ,
4038 locales : {
4139 root : {
42- lang : 'zh-CN' ,
43- label : '简体中文' ,
44- title : '一键虚拟化项目' ,
45- description : '开源、易于使用的服务器虚拟化项目' ,
46- link : '/' ,
47- themeConfig : {
48- logo : { src : 'https://raw.githubusercontent.com/spiritlhls/pages/main/logo.png' , width : 24 , height : 24 } ,
49- lastUpdatedText : '上次更新' ,
50- editLink : {
51- pattern : 'https://github.com/oneclickvirt/oneclickvirt.github.io/edit/main/docs/:path' ,
52- text : '在GitHub中编辑' ,
40+ lang : 'zh-CN' ,
41+ label : '简体中文' ,
42+ title : '一键虚拟化项目' ,
43+ description : '开源、易于使用的服务器虚拟化项目' ,
44+ link : '/' ,
45+ themeConfig : {
46+ logo : { src : 'https://cdn.spiritlhl.net/https://raw.githubusercontent.com/spiritlhls/pages/main/logo.png' } ,
47+ lastUpdatedText : '上次更新' ,
48+ editLink : {
49+ pattern : 'https://github.com/oneclickvirt/oneclickvirt.github.io/edit/main/docs/:path' ,
50+ text : '在GitHub中编辑' ,
51+ } ,
52+ nav : [
53+ {
54+ text : '一键虚拟化' ,
55+ link : '/' ,
56+ activeMatch : '^/$|^/guide/'
5357 } ,
54- nav : [
55- { text : '一键虚拟化' ,
56- link : '/' ,
57- activeMatch : '^/$|^/guide/'
58- } ,
59- { text : 'Linux相关项目' ,
60- link : '/case/index' ,
61- activeMatch : '^/case/'
62- } ,
63- // {
64- // text: '开发手册',
65- // link: '/developer/index',
66- // activeMatch: '^/developer/'
67- // },
68- { text : 'VPS余量监控' , link : 'https://spiders.spiritlhl.net/' } ,
69- { text : 'VPS测试存档' , link : 'https://beta.spiritlhl.net/' }
70- ] ,
71- sidebar : {
72- '/' : getGuideSidebarZhCN ( ) ,
73- '/guide/' : getGuideSidebarZhCN ( ) ,
74- '/case/' : getCaseSidebarZhCN ( ) ,
75- '/developer/' : getDeveloperSidebarZhCN ( ) ,
76- }
77- }
78- } ,
79- en : {
80- lang : 'en-US' ,
81- label : 'English' ,
82- title : 'One Click Virtualization' ,
83- description : 'Open source, easy to use server virtualization project' ,
84- link : '/en/' ,
85- themeConfig : {
86- logo : { src : 'https://raw.githubusercontent.com/spiritlhls/pages/main/logo.png' , width : 24 , height : 24 } ,
87- lastUpdatedText : 'Last Updated' ,
88- editLink : {
89- text : 'Edit this page on GitHub' ,
90- pattern : 'https://github.com/oneclickvirt/oneclickvirt.github.io/edit/main/docs/:path' ,
58+ {
59+ text : 'Linux相关项目' ,
60+ link : '/case/index' ,
61+ activeMatch : '^/case/'
9162 } ,
92- nav : [
93- { text : 'One Click Virtualization' , link : '/en/' , activeMatch : '^/en/guide/' } ,
94- // { text: 'Development Manual', link: '/en/developer/index', activeMatch: '^/en/developer/' },
95- { text : 'VPS Stock Monitor' , link : 'https://spiders.spiritlhl.net/' } ,
96- { text : 'VPS Test Archive' , link : 'https://beta.spiritlhl.net/' }
97- ] ,
98- sidebar : {
99- '/en/' : getGuideSidebarEnUS ( ) ,
100- '/en/guide/' : getGuideSidebarEnUS ( ) ,
101- '/en/developer/' : getDeveloperSidebarEnUS ( )
63+ // {
64+ // text: '开发手册',
65+ // link: '/developer/index',
66+ // activeMatch: '^/developer/'
67+ // },
68+ { text : 'VPS余量监控' , link : 'https://spiders.spiritlhl.net/' } ,
69+ { text : 'VPS测试存档' , link : 'https://beta.spiritlhl.net/' }
70+ ] ,
71+ sidebar : {
72+ '/' : getGuideSidebarZhCN ( ) ,
73+ '/guide/' : getGuideSidebarZhCN ( ) ,
74+ '/case/' : getCaseSidebarZhCN ( ) ,
75+ '/developer/' : getDeveloperSidebarZhCN ( ) ,
76+ }
77+ }
78+ } ,
79+ en : {
80+ lang : 'en-US' ,
81+ label : 'English' ,
82+ title : 'One Click Virtualization' ,
83+ description : 'Open source, easy to use server virtualization project' ,
84+ link : '/en/' ,
85+ themeConfig : {
86+ logo : { src : 'https://cdn.spiritlhl.net/https://raw.githubusercontent.com/spiritlhls/pages/main/logo.png' } ,
87+ lastUpdatedText : 'Last Updated' ,
88+ editLink : {
89+ text : 'Edit this page on GitHub' ,
90+ pattern : 'https://github.com/oneclickvirt/oneclickvirt.github.io/edit/main/docs/:path' ,
91+ } ,
92+ nav : [
93+ { text : 'One Click Virtualization' , link : '/en/' , activeMatch : '^/en/guide/' } ,
94+ // { text: 'Development Manual', link: '/en/developer/index', activeMatch: '^/en/developer/' },
95+ { text : 'VPS Stock Monitor' , link : 'https://spiders.spiritlhl.net/' } ,
96+ { text : 'VPS Test Archive' , link : 'https://beta.spiritlhl.net/' }
97+ ] ,
98+ sidebar : {
99+ '/en/' : getGuideSidebarEnUS ( ) ,
100+ '/en/guide/' : getGuideSidebarEnUS ( ) ,
101+ '/en/developer/' : getDeveloperSidebarEnUS ( )
102102 } ,
103103 } ,
104104 } ,
@@ -117,7 +117,7 @@ export default defineConfig({
117117 copyright : 'Copyright © 2022-present oneclickvirt'
118118 }
119119 }
120- } )
120+ } ) ;
121121
122122function getGuideSidebarZhCN ( ) {
123123 return [
@@ -191,7 +191,7 @@ function getGuideSidebarZhCN() {
191191 { text : '捐赠' , link : '/guide/dashboardq.html' } ,
192192 ]
193193 }
194- ]
194+ ] ;
195195}
196196
197197function getCaseSidebarZhCN ( ) {
@@ -210,7 +210,7 @@ function getCaseSidebarZhCN() {
210210 { text : '9. convoy面板安装脚本' , link : '/case/case9.html' }
211211 ]
212212 }
213- ]
213+ ] ;
214214}
215215
216216function getDeveloperSidebarZhCN ( ) {
@@ -221,7 +221,7 @@ function getDeveloperSidebarZhCN() {
221221 { text : 'l10n' , link : '/developer/l10n.html' }
222222 ]
223223 }
224- ]
224+ ] ;
225225}
226226
227227function getGuideSidebarEnUS ( ) {
@@ -239,6 +239,7 @@ function getGuideSidebarEnUS() {
239239 { text : 'PVE main installation' , link : '/en/guide/pve/pve_install.html' } ,
240240 { text : 'KVM Virtualization' , link : '/en/guide/pve/pve_kvm.html' } ,
241241 { text : 'LXC Virtualization' , link : '/en/guide/pve/pve_lxc.html' } ,
242+ { text : 'Windows Virtual Machine' , link : '/en/guide/pve/pve_windows.html' } ,
242243 { text : 'Custom' , link : '/en/guide/pve/pve_custom.html' } ,
243244 { text : 'Acknowledgements' , link : '/en/guide/pve/pve_thanks.html' } ,
244245 { text : 'FAQ' , link : '/en/guide/pve/pve_qa.html' }
@@ -295,7 +296,7 @@ function getGuideSidebarEnUS() {
295296 { text : 'Donation' , link : '/guide/dashboardq.html' }
296297 ]
297298 }
298- ]
299+ ] ;
299300}
300301
301302function getDeveloperSidebarEnUS ( ) {
@@ -306,5 +307,5 @@ function getDeveloperSidebarEnUS() {
306307 { text : 'l10n' , link : '/en/developer/l10n.html' }
307308 ]
308309 }
309- ]
310- }
310+ ] ;
311+ }
0 commit comments