docs: add config.ts example

pull/410/head
YunYouJun 4 years ago
parent e3a191e49e
commit 5db36a2dd6

@ -1,3 +1,5 @@
import type { UserConfig } from 'vitepress'
export default { export default {
lang: 'en-US', lang: 'en-US',
title: 'VitePress', title: 'VitePress',
@ -41,7 +43,7 @@ export default {
'/': getGuideSidebar() '/': getGuideSidebar()
} }
} }
} } as UserConfig
function getGuideSidebar() { function getGuideSidebar() {
return [ return [

@ -20,4 +20,15 @@ module.exports = {
} }
``` ```
If you are using TypeScript, you can use `.vitepress/config.ts` instead to get better types hint for VitePress Config.
```ts
import type { UserConfig } from 'vitepress'
export default {
title: 'Hello VitePress',
description: 'Just playing around.'
} as UserConfig
```
Check out the [Config Reference](/config/basics) for a full list of options. Check out the [Config Reference](/config/basics) for a full list of options.

Loading…
Cancel
Save