You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vitepress/docs/.vitepress/config.ts

180 lines
4.9 KiB

import { createRequire } from 'module'
import { defineConfig, type DefaultTheme } from 'vitepress'
const require = createRequire(import.meta.url)
const pkg = require('vitepress/package.json')
export default defineConfig({
lang: 'en-US',
title: 'VitePress',
description: 'Vite & Vue powered static site generator.',
lastUpdated: true,
cleanUrls: true,
sitemap: {
hostname: 'https://vitepress.dev',
transformItems(items) {
return items.filter((item) => !item.url.includes('migration'))
}
},
head: [
['meta', { name: 'theme-color', content: '#3c8772' }],
[
'script',
{
src: 'https://cdn.usefathom.com/script.js',
'data-site': 'AZBRSFGG',
'data-spa': 'auto',
defer: ''
}
]
],
themeConfig: {
nav: nav(),
sidebar: {
'/guide/': { base: '/guide/', items: sidebarGuide() },
'/reference/': { base: '/reference/', items: sidebarReference() }
},
editLink: {
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path',
text: 'Edit this page on GitHub'
},
socialLinks: [
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }
],
footer: {
message: 'Released under the MIT License.',
copyright: 'Copyright © 2019-present Evan You'
},
search: {
provider: 'algolia',
options: {
appId: '8J64VVRP8K',
apiKey: 'a18e2f4cc5665f6602c5631fd868adfd',
indexName: 'vitepress'
}
},
carbonAds: {
code: 'CEBDT27Y',
placement: 'vuejsorg'
}
}
})
function nav(): DefaultTheme.NavItem[] {
return [
{
text: 'Guide',
link: '/guide/what-is-vitepress',
activeMatch: '/guide/'
},
{
text: 'Reference',
link: '/reference/site-config',
activeMatch: '/reference/'
2 years ago
},
{
text: pkg.version,
items: [
{
text: 'Changelog',
link: 'https://github.com/vuejs/vitepress/blob/main/CHANGELOG.md'
},
{
text: 'Contributing',
link: 'https://github.com/vuejs/vitepress/blob/main/.github/contributing.md'
}
]
}
]
}
/* prettier-ignore */
function sidebarGuide(): DefaultTheme.SidebarItem[] {
return [
{
text: 'Introduction',
collapsed: false,
items: [
{ text: 'What is VitePress?', link: 'what-is-vitepress' },
{ text: 'Getting Started', link: 'getting-started' },
{ text: 'Routing', link: 'routing' },
{ text: 'Deploy', link: 'deploy' }
]
},
{
text: 'Writing',
collapsed: false,
items: [
{ text: 'Markdown Extensions', link: 'markdown' },
{ text: 'Asset Handling', link: 'asset-handling' },
{ text: 'Frontmatter', link: 'frontmatter' },
{ text: 'Using Vue in Markdown', link: 'using-vue' },
{ text: 'Internationalization', link: 'i18n' }
]
},
{
2 years ago
text: 'Customization',
collapsed: false,
items: [
{ text: 'Using a Custom Theme', link: 'custom-theme' },
{ text: 'Extending the Default Theme', link: 'extending-default-theme' },
{ text: 'Build-Time Data Loading', link: 'data-loading' },
{ text: 'SSR Compatibility', link: 'ssr-compat' },
{ text: 'Connecting to a CMS', link: 'cms' }
]
},
2 years ago
{
text: 'Experimental',
collapsed: false,
items: [
{ text: 'MPA Mode', link: 'mpa-mode' },
{ text: 'Sitemap Generation', link: 'sitemap-generation' }
2 years ago
]
},
{ text: 'Config & API Reference', base: '/reference/', link: 'site-config' }
]
}
/* prettier-ignore */
function sidebarReference(): DefaultTheme.SidebarItem[] {
return [
{
text: 'Reference',
items: [
{ text: 'Site Config', link: 'site-config' },
{ text: 'Frontmatter Config', link: 'frontmatter-config' },
{ text: 'Runtime API', link: 'runtime-api' },
{ text: 'CLI', link: 'cli' },
{
text: 'Default Theme',
items: [
{ text: 'Overview', link: 'default-theme-config' },
{ text: 'Nav', link: 'default-theme-nav' },
{ text: 'Sidebar', link: 'default-theme-sidebar' },
{ text: 'Home Page', link: 'default-theme-home-page' },
{ text: 'Footer', link: 'default-theme-footer' },
{ text: 'Layout', link: 'default-theme-layout' },
{ text: 'Badge', link: 'default-theme-badge' },
{ text: 'Team Page', link: 'default-theme-team-page' },
{ text: 'Prev / Next Links', link: 'default-theme-prev-next-links' },
{ text: 'Edit Link', link: 'default-theme-edit-link' },
{ text: 'Last Updated Timestamp', link: 'default-theme-last-updated' },
{ text: 'Search', link: 'default-theme-search' },
{ text: 'Carbon Ads', link: 'default-theme-carbon-ads' }
]
}
]
}
]
}