1
1
import { defineConfig } from 'vitepress'
2
- import renderPermaLink from './render-perma-link'
3
- import MarkDownItCustomAnchor from './markdown-it-custom-anchor'
4
2
5
3
const ogDescription = 'Next Generation Frontend Tooling'
6
4
const ogImage = 'https://vitejs.dev/og-image.png'
7
5
const ogTitle = 'Vite'
8
6
const ogUrl = 'https://vitejs.dev'
9
7
8
+ // netlify envs
9
+ const deployURL = process . env . DEPLOY_PRIME_URL || ''
10
+ const commitRef = process . env . COMMIT_REF ?. slice ( 0 , 8 ) || 'dev'
11
+
12
+ const deployType = ( ( ) => {
13
+ switch ( deployURL ) {
14
+ case 'https://main--vite-docs-main.netlify.app' :
15
+ return 'main'
16
+ case '' :
17
+ return 'local'
18
+ default :
19
+ return 'release'
20
+ }
21
+ } ) ( )
22
+ const additionalTitle = ( ( ) : string => {
23
+ switch ( deployType ) {
24
+ case 'main' :
25
+ return ' (main branch)'
26
+ case 'local' :
27
+ return ' (local)'
28
+ case 'release' :
29
+ return ''
30
+ }
31
+ } ) ( )
32
+ const versionLinks = ( ( ) : DefaultTheme . NavItemWithLink [ ] => {
33
+ const oldVersions : DefaultTheme . NavItemWithLink [ ] = [
34
+ {
35
+ text : 'Vite 4 Docs' ,
36
+ link : 'https://v4.vitejs.dev' ,
37
+ } ,
38
+ {
39
+ text : 'Vite 3 Docs' ,
40
+ link : 'https://v3.vitejs.dev' ,
41
+ } ,
42
+ {
43
+ text : 'Vite 2 Docs' ,
44
+ link : 'https://v2.vitejs.dev' ,
45
+ } ,
46
+ ]
47
+
48
+ switch ( deployType ) {
49
+ case 'main' :
50
+ case 'local' :
51
+ return [
52
+ {
53
+ text : 'Vite 5 Docs (release)' ,
54
+ link : 'https://vitejs.dev' ,
55
+ } ,
56
+ ...oldVersions ,
57
+ ]
58
+ case 'release' :
59
+ return oldVersions
60
+ }
61
+ } ) ( )
62
+
10
63
export default defineConfig ( {
11
64
title : 'Vite 官方中文文档' ,
12
65
description : '下一代前端工具链' ,
@@ -40,6 +93,7 @@ export default defineConfig({
40
93
es : { label : 'Español' , link : 'https://es.vitejs.dev' } ,
41
94
pt : { label : 'Português' , link : 'https://pt.vitejs.dev' } ,
42
95
ko : { label : '한국어' , link : 'https://ko.vitejs.dev' } ,
96
+ de : { label : 'Deutsch' , link : 'https://de.vitejs.dev' } ,
43
97
} ,
44
98
45
99
themeConfig : {
@@ -51,7 +105,8 @@ export default defineConfig({
51
105
} ,
52
106
53
107
outline : {
54
- label : '本页目录'
108
+ label : '本页目录' ,
109
+ level : [ 2 , 3 ] ,
55
110
} ,
56
111
57
112
socialLinks : [
@@ -127,31 +182,44 @@ export default defineConfig({
127
182
text : '相关链接' ,
128
183
items : [
129
184
{ text : 'Team' , link : '/team' } ,
185
+ { text : 'Blog' , link : '/blog' } ,
130
186
{ text : 'Releases' , link : '/releases' } ,
131
187
{
132
- text : 'Twitter' ,
133
- link : 'https://twitter.com/vite_js'
134
- } ,
135
- {
136
- text : 'Discord Chat' ,
137
- link : 'https://chat.vitejs.dev'
138
- } ,
139
- {
140
- text : 'Awesome Vite' ,
141
- link : 'https://github.com/vitejs/awesome-vite'
142
- } ,
143
- {
144
- text : 'Dev.to 社区' ,
145
- link : 'https://dev.to/t/vite'
188
+ items : [
189
+ {
190
+ text : 'Twitter' ,
191
+ link : 'https://twitter.com/vite_js' ,
192
+ } ,
193
+ {
194
+ text : 'Discord 聊天室' ,
195
+ link : 'https://chat.vitejs.dev'
196
+ } ,
197
+ {
198
+ text : 'Awesome Vite' ,
199
+ link : 'https://github.com/vitejs/awesome-vite'
200
+ } ,
201
+ {
202
+ text : 'ViteConf' ,
203
+ link : 'https://viteconf.org' ,
204
+ } ,
205
+ {
206
+ text : 'Dev.to 社区' ,
207
+ link : 'https://dev.to/t/vite'
208
+ } ,
209
+ {
210
+ text : 'Rollup 插件兼容' ,
211
+ link : 'https://vite-rollup-plugins.patak.dev/'
212
+ } ,
213
+ {
214
+ text : '更新日志' ,
215
+ link : 'https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md'
216
+ } ,
217
+ {
218
+ text : '贡献指南' ,
219
+ link : 'https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md' ,
220
+ } ,
221
+ ] ,
146
222
} ,
147
- {
148
- text : 'Rollup 插件兼容' ,
149
- link : 'https://vite-rollup-plugins.patak.dev/'
150
- } ,
151
- {
152
- text : '更新日志' ,
153
- link : 'https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md'
154
- }
155
223
]
156
224
} ,
157
225
{
@@ -230,12 +298,16 @@ export default defineConfig({
230
298
text : '故障排除' ,
231
299
link : '/guide/troubleshooting'
232
300
} ,
301
+ {
302
+ text : '性能' ,
303
+ link : '/guide/performance' ,
304
+ } ,
233
305
{
234
306
text : '理念' ,
235
307
link : '/guide/philosophy' ,
236
308
} ,
237
309
{
238
- text : '从 v3 迁移' ,
310
+ text : '从 v4 迁移' ,
239
311
link : '/guide/migration'
240
312
} ,
241
313
] ,
@@ -296,11 +368,11 @@ export default defineConfig({
296
368
} ,
297
369
{
298
370
text : 'Worker 选项' ,
299
- link : '/config/worker-options'
300
- }
301
- ]
302
- }
303
- ]
304
- }
371
+ link : '/config/worker-options' ,
372
+ } ,
373
+ ] ,
374
+ } ,
375
+ ] ,
376
+ } ,
305
377
} ,
306
378
} )
0 commit comments