|
| 1 | +import { createRequire } from 'module' |
| 2 | +import { defineAdditionalConfig, type DefaultTheme } from 'vitepress' |
| 3 | + |
| 4 | +const require = createRequire(import.meta.url) |
| 5 | +const pkg = require('vitepress/package.json') |
| 6 | + |
| 7 | +export default defineAdditionalConfig({ |
| 8 | + lang: 'en-US', |
| 9 | + description: 'Vite & Vue powered static site generator.', |
| 10 | + |
| 11 | + themeConfig: { |
| 12 | + nav: nav(), |
| 13 | + |
| 14 | + sidebar: { |
| 15 | + '/guide/': { base: '/guide/', items: sidebarGuide() }, |
| 16 | + '/reference/': { base: '/reference/', items: sidebarReference() } |
| 17 | + }, |
| 18 | + |
| 19 | + editLink: { |
| 20 | + pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path', |
| 21 | + text: 'Edit this page on GitHub' |
| 22 | + }, |
| 23 | + |
| 24 | + footer: { |
| 25 | + message: 'Released under the MIT License.', |
| 26 | + copyright: 'Copyright © 2019-present Evan You' |
| 27 | + } |
| 28 | + } |
| 29 | +}) |
| 30 | + |
| 31 | +function nav(): DefaultTheme.NavItem[] { |
| 32 | + return [ |
| 33 | + { |
| 34 | + text: 'Guide', |
| 35 | + link: '/guide/what-is-vitepress', |
| 36 | + activeMatch: '/guide/' |
| 37 | + }, |
| 38 | + { |
| 39 | + text: 'Reference', |
| 40 | + link: '/reference/site-config', |
| 41 | + activeMatch: '/reference/' |
| 42 | + }, |
| 43 | + { |
| 44 | + text: pkg.version, |
| 45 | + items: [ |
| 46 | + { |
| 47 | + text: 'Changelog', |
| 48 | + link: 'https://github.com/vuejs/vitepress/blob/main/CHANGELOG.md' |
| 49 | + }, |
| 50 | + { |
| 51 | + text: 'Contributing', |
| 52 | + link: 'https://github.com/vuejs/vitepress/blob/main/.github/contributing.md' |
| 53 | + } |
| 54 | + ] |
| 55 | + } |
| 56 | + ] |
| 57 | +} |
| 58 | + |
| 59 | +function sidebarGuide(): DefaultTheme.SidebarItem[] { |
| 60 | + return [ |
| 61 | + { |
| 62 | + text: 'Introduction', |
| 63 | + collapsed: false, |
| 64 | + items: [ |
| 65 | + { text: 'What is VitePress?', link: 'what-is-vitepress' }, |
| 66 | + { text: 'Getting Started', link: 'getting-started' }, |
| 67 | + { text: 'Routing', link: 'routing' }, |
| 68 | + { text: 'Deploy', link: 'deploy' } |
| 69 | + ] |
| 70 | + }, |
| 71 | + { |
| 72 | + text: 'Writing', |
| 73 | + collapsed: false, |
| 74 | + items: [ |
| 75 | + { text: 'Markdown Extensions', link: 'markdown' }, |
| 76 | + { text: 'Asset Handling', link: 'asset-handling' }, |
| 77 | + { text: 'Frontmatter', link: 'frontmatter' }, |
| 78 | + { text: 'Using Vue in Markdown', link: 'using-vue' }, |
| 79 | + { text: 'Internationalization', link: 'i18n' } |
| 80 | + ] |
| 81 | + }, |
| 82 | + { |
| 83 | + text: 'Customization', |
| 84 | + collapsed: false, |
| 85 | + items: [ |
| 86 | + { text: 'Using a Custom Theme', link: 'custom-theme' }, |
| 87 | + { |
| 88 | + text: 'Extending the Default Theme', |
| 89 | + link: 'extending-default-theme' |
| 90 | + }, |
| 91 | + { text: 'Build-Time Data Loading', link: 'data-loading' }, |
| 92 | + { text: 'SSR Compatibility', link: 'ssr-compat' }, |
| 93 | + { text: 'Connecting to a CMS', link: 'cms' } |
| 94 | + ] |
| 95 | + }, |
| 96 | + { |
| 97 | + text: 'Experimental', |
| 98 | + collapsed: false, |
| 99 | + items: [ |
| 100 | + { text: 'MPA Mode', link: 'mpa-mode' }, |
| 101 | + { text: 'Sitemap Generation', link: 'sitemap-generation' } |
| 102 | + ] |
| 103 | + }, |
| 104 | + { text: 'Config & API Reference', base: '/reference/', link: 'site-config' } |
| 105 | + ] |
| 106 | +} |
| 107 | + |
| 108 | +function sidebarReference(): DefaultTheme.SidebarItem[] { |
| 109 | + return [ |
| 110 | + { |
| 111 | + text: 'Reference', |
| 112 | + items: [ |
| 113 | + { text: 'Site Config', link: 'site-config' }, |
| 114 | + { text: 'Frontmatter Config', link: 'frontmatter-config' }, |
| 115 | + { text: 'Runtime API', link: 'runtime-api' }, |
| 116 | + { text: 'CLI', link: 'cli' }, |
| 117 | + { |
| 118 | + text: 'Default Theme', |
| 119 | + base: '/reference/default-theme-', |
| 120 | + items: [ |
| 121 | + { text: 'Overview', link: 'config' }, |
| 122 | + { text: 'Nav', link: 'nav' }, |
| 123 | + { text: 'Sidebar', link: 'sidebar' }, |
| 124 | + { text: 'Home Page', link: 'home-page' }, |
| 125 | + { text: 'Footer', link: 'footer' }, |
| 126 | + { text: 'Layout', link: 'layout' }, |
| 127 | + { text: 'Badge', link: 'badge' }, |
| 128 | + { text: 'Team Page', link: 'team-page' }, |
| 129 | + { text: 'Prev / Next Links', link: 'prev-next-links' }, |
| 130 | + { text: 'Edit Link', link: 'edit-link' }, |
| 131 | + { text: 'Last Updated Timestamp', link: 'last-updated' }, |
| 132 | + { text: 'Search', link: 'search' }, |
| 133 | + { text: 'Carbon Ads', link: 'carbon-ads' } |
| 134 | + ] |
| 135 | + } |
| 136 | + ] |
| 137 | + } |
| 138 | + ] |
| 139 | +} |
0 commit comments