1
1
import { createRequire } from 'module'
2
- import { defineConfig } from 'vitepress'
2
+ import { defineConfig , type DefaultTheme } from 'vitepress'
3
3
4
4
const require = createRequire ( import . meta. url )
5
5
const pkg = require ( 'vitepress/package.json' )
@@ -36,8 +36,8 @@ export default defineConfig({
36
36
nav : nav ( ) ,
37
37
38
38
sidebar : {
39
- '/guide/' : sidebarGuide ( ) ,
40
- '/reference/' : sidebarReference ( )
39
+ '/guide/' : { base : '/guide/' , items : sidebarGuide ( ) } ,
40
+ '/reference/' : { base : '/reference/' , items : sidebarReference ( ) }
41
41
} ,
42
42
43
43
editLink : {
@@ -70,9 +70,13 @@ export default defineConfig({
70
70
}
71
71
} )
72
72
73
- function nav ( ) {
73
+ function nav ( ) : DefaultTheme . NavItem [ ] {
74
74
return [
75
- { text : 'Guide' , link : '/guide/what-is-vitepress' , activeMatch : '/guide/' } ,
75
+ {
76
+ text : 'Guide' ,
77
+ link : '/guide/what-is-vitepress' ,
78
+ activeMatch : '/guide/'
79
+ } ,
76
80
{
77
81
text : 'Reference' ,
78
82
link : '/reference/site-config' ,
@@ -94,142 +98,79 @@ function nav() {
94
98
]
95
99
}
96
100
97
- function sidebarGuide ( ) {
101
+ /* prettier-ignore */
102
+ function sidebarGuide ( ) : DefaultTheme . SidebarItem [ ] {
98
103
return [
99
104
{
100
105
text : 'Introduction' ,
101
106
collapsed : false ,
102
107
items : [
103
- { text : 'What is VitePress?' , link : '/guide/ what-is-vitepress' } ,
104
- { text : 'Getting Started' , link : '/guide/ getting-started' } ,
105
- { text : 'Routing' , link : '/guide/ routing' } ,
106
- { text : 'Deploy' , link : '/guide/ deploy' }
108
+ { text : 'What is VitePress?' , link : 'what-is-vitepress' } ,
109
+ { text : 'Getting Started' , link : 'getting-started' } ,
110
+ { text : 'Routing' , link : 'routing' } ,
111
+ { text : 'Deploy' , link : 'deploy' }
107
112
]
108
113
} ,
109
114
{
110
115
text : 'Writing' ,
111
116
collapsed : false ,
112
117
items : [
113
- { text : 'Markdown Extensions' , link : '/guide/ markdown' } ,
114
- { text : 'Asset Handling' , link : '/guide/ asset-handling' } ,
115
- { text : 'Frontmatter' , link : '/guide/ frontmatter' } ,
116
- { text : 'Using Vue in Markdown' , link : '/guide/ using-vue' } ,
117
- { text : 'Internationalization' , link : '/guide/ i18n' }
118
+ { text : 'Markdown Extensions' , link : 'markdown' } ,
119
+ { text : 'Asset Handling' , link : 'asset-handling' } ,
120
+ { text : 'Frontmatter' , link : 'frontmatter' } ,
121
+ { text : 'Using Vue in Markdown' , link : 'using-vue' } ,
122
+ { text : 'Internationalization' , link : 'i18n' }
118
123
]
119
124
} ,
120
125
{
121
126
text : 'Customization' ,
122
127
collapsed : false ,
123
128
items : [
124
- { text : 'Using a Custom Theme' , link : '/guide/custom-theme' } ,
125
- {
126
- text : 'Extending the Default Theme' ,
127
- link : '/guide/extending-default-theme'
128
- } ,
129
- { text : 'Build-Time Data Loading' , link : '/guide/data-loading' } ,
130
- { text : 'SSR Compatibility' , link : '/guide/ssr-compat' } ,
131
- { text : 'Connecting to a CMS' , link : '/guide/cms' }
129
+ { text : 'Using a Custom Theme' , link : 'custom-theme' } ,
130
+ { text : 'Extending the Default Theme' , link : 'extending-default-theme' } ,
131
+ { text : 'Build-Time Data Loading' , link : 'data-loading' } ,
132
+ { text : 'SSR Compatibility' , link : 'ssr-compat' } ,
133
+ { text : 'Connecting to a CMS' , link : 'cms' }
132
134
]
133
135
} ,
134
136
{
135
137
text : 'Experimental' ,
136
138
collapsed : false ,
137
139
items : [
138
- {
139
- text : 'MPA Mode' ,
140
- link : '/guide/mpa-mode'
141
- } ,
142
- {
143
- text : 'Sitemap Generation' ,
144
- link : '/guide/sitemap-generation'
145
- }
140
+ { text : 'MPA Mode' , link : 'mpa-mode' } ,
141
+ { text : 'Sitemap Generation' , link : 'sitemap-generation' }
146
142
]
147
143
} ,
148
- // {
149
- // text: 'Migrations',
150
- // collapsed: false,
151
- // items: [
152
- // {
153
- // text: 'Migration from VuePress',
154
- // link: '/guide/migration-from-vuepress'
155
- // },
156
- // {
157
- // text: 'Migration from VitePress 0.x',
158
- // link: '/guide/migration-from-vitepress-0'
159
- // }
160
- // ]
161
- // },
162
- {
163
- text : 'Config & API Reference' ,
164
- link : '/reference/site-config'
165
- }
144
+ { text : 'Config & API Reference' , base : '/reference/' , link : 'site-config' }
166
145
]
167
146
}
168
147
169
- function sidebarReference ( ) {
148
+ /* prettier-ignore */
149
+ function sidebarReference ( ) : DefaultTheme . SidebarItem [ ] {
170
150
return [
171
151
{
172
152
text : 'Reference' ,
173
153
items : [
174
- { text : 'Site Config' , link : '/reference/ site-config' } ,
175
- { text : 'Frontmatter Config' , link : '/reference/ frontmatter-config' } ,
176
- { text : 'Runtime API' , link : '/reference/ runtime-api' } ,
177
- { text : 'CLI' , link : '/reference/ cli' } ,
154
+ { text : 'Site Config' , link : 'site-config' } ,
155
+ { text : 'Frontmatter Config' , link : 'frontmatter-config' } ,
156
+ { text : 'Runtime API' , link : 'runtime-api' } ,
157
+ { text : 'CLI' , link : 'cli' } ,
178
158
{
179
159
text : 'Default Theme' ,
180
160
items : [
181
- {
182
- text : 'Overview' ,
183
- link : '/reference/default-theme-config'
184
- } ,
185
- {
186
- text : 'Nav' ,
187
- link : '/reference/default-theme-nav'
188
- } ,
189
- {
190
- text : 'Sidebar' ,
191
- link : '/reference/default-theme-sidebar'
192
- } ,
193
- {
194
- text : 'Home Page' ,
195
- link : '/reference/default-theme-home-page'
196
- } ,
197
- {
198
- text : 'Footer' ,
199
- link : '/reference/default-theme-footer'
200
- } ,
201
- {
202
- text : 'Layout' ,
203
- link : '/reference/default-theme-layout'
204
- } ,
205
- {
206
- text : 'Badge' ,
207
- link : '/reference/default-theme-badge'
208
- } ,
209
- {
210
- text : 'Team Page' ,
211
- link : '/reference/default-theme-team-page'
212
- } ,
213
- {
214
- text : 'Prev / Next Links' ,
215
- link : '/reference/default-theme-prev-next-links'
216
- } ,
217
- {
218
- text : 'Edit Link' ,
219
- link : '/reference/default-theme-edit-link'
220
- } ,
221
- {
222
- text : 'Last Updated Timestamp' ,
223
- link : '/reference/default-theme-last-updated'
224
- } ,
225
- {
226
- text : 'Search' ,
227
- link : '/reference/default-theme-search'
228
- } ,
229
- {
230
- text : 'Carbon Ads' ,
231
- link : '/reference/default-theme-carbon-ads'
232
- }
161
+ { text : 'Overview' , link : 'default-theme-config' } ,
162
+ { text : 'Nav' , link : 'default-theme-nav' } ,
163
+ { text : 'Sidebar' , link : 'default-theme-sidebar' } ,
164
+ { text : 'Home Page' , link : 'default-theme-home-page' } ,
165
+ { text : 'Footer' , link : 'default-theme-footer' } ,
166
+ { text : 'Layout' , link : 'default-theme-layout' } ,
167
+ { text : 'Badge' , link : 'default-theme-badge' } ,
168
+ { text : 'Team Page' , link : 'default-theme-team-page' } ,
169
+ { text : 'Prev / Next Links' , link : 'default-theme-prev-next-links' } ,
170
+ { text : 'Edit Link' , link : 'default-theme-edit-link' } ,
171
+ { text : 'Last Updated Timestamp' , link : 'default-theme-last-updated' } ,
172
+ { text : 'Search' , link : 'default-theme-search' } ,
173
+ { text : 'Carbon Ads' , link : 'default-theme-carbon-ads' }
233
174
]
234
175
}
235
176
]
0 commit comments