From 7200c53a8af015f06f867d72a8a64d46f1be0276 Mon Sep 17 00:00:00 2001 From: zernonia Date: Wed, 6 Sep 2023 18:18:11 +0800 Subject: [PATCH] docs: improve docs site --- apps/www/.vitepress/config.mts | 36 +++++++++++++++++-- .../.vitepress/theme/components/EditLink.vue | 27 ++++++++++++++ .../theme/components/LandingPage.vue | 2 +- .../.vitepress/theme/layout/DocsLayout.vue | 6 +++- .../.vitepress/theme/layout/MainLayout.vue | 19 +++++----- apps/www/src/content/index.md | 1 + .../src/examples/authentication/Example.vue | 2 +- apps/www/src/examples/cards/Example.vue | 2 +- .../examples/cards/components/GitHubCard.vue | 1 - apps/www/src/examples/dashboard/Example.vue | 2 +- .../examples/dashboard/components/MainNav.vue | 16 ++++----- .../examples/dashboard/components/UserNav.vue | 2 +- apps/www/src/examples/music/Example.vue | 2 +- .../src/examples/music/components/Menu.vue | 2 +- apps/www/src/examples/playground/Example.vue | 2 +- apps/www/src/examples/tasks/Example.vue | 2 +- .../src/examples/tasks/components/UserNav.vue | 2 +- 17 files changed, 95 insertions(+), 31 deletions(-) create mode 100644 apps/www/.vitepress/theme/components/EditLink.vue diff --git a/apps/www/.vitepress/config.mts b/apps/www/.vitepress/config.mts index eea8be18..d949813d 100644 --- a/apps/www/.vitepress/config.mts +++ b/apps/www/.vitepress/config.mts @@ -1,12 +1,44 @@ import path from 'node:path' import { defineConfig } from 'vitepress' import Icons from 'unplugin-icons/vite' +import { siteConfig } from './theme/config/site' import ComponentPreviewPlugin from './theme/plugins/previewer' // https://vitepress.dev/reference/site-config export default defineConfig({ - title: 'shadcn-vue', - description: 'A VitePress Site', + title: siteConfig.name, + titleTemplate: ':title - shadcn/vue', + description: siteConfig.description, + head: [ + ['link', { rel: 'icon', href: '/favicon.ico' }], + ['meta', { name: 'theme-color', content: '#41b883' }], + ['meta', { name: 'og:type', content: 'website' }], + ['meta', { name: 'og:locale', content: 'en' }], + ['meta', { name: 'og:site_name', content: siteConfig.name }], + ['meta', { name: 'og:image', content: siteConfig.ogImage }], + ['meta', { name: 'twitter:image', content: siteConfig.ogImage }], + + ], + + sitemap: { + hostname: 'https://www.shadcn-vue.com', + transformItems(items) { + return items.filter(item => !item.url.includes('migration')) + }, + }, + + appearance: false, + lastUpdated: true, + themeConfig: { + search: { + provider: 'local', + }, + editLink: { + pattern: 'https://github.com/radix-vue/shadcn-vue/tree/dev/apps/www/src/:path', + text: 'Edit this page on GitHub', + }, + }, + srcDir: path.resolve(__dirname, '../src'), markdown: { theme: 'css-variables', diff --git a/apps/www/.vitepress/theme/components/EditLink.vue b/apps/www/.vitepress/theme/components/EditLink.vue new file mode 100644 index 00000000..7ff8faeb --- /dev/null +++ b/apps/www/.vitepress/theme/components/EditLink.vue @@ -0,0 +1,27 @@ + + + diff --git a/apps/www/.vitepress/theme/components/LandingPage.vue b/apps/www/.vitepress/theme/components/LandingPage.vue index d35022c7..403179bc 100644 --- a/apps/www/.vitepress/theme/components/LandingPage.vue +++ b/apps/www/.vitepress/theme/components/LandingPage.vue @@ -59,7 +59,7 @@ import DashboardExample from '@/examples/dashboard/Example.vue' width="1280" height="866" class="block" :image="{ dark: '/examples/dashboard-dark.png', - light: 'examples/dashboard-light.png', + light: '/examples/dashboard-light.png', }" /> diff --git a/apps/www/.vitepress/theme/layout/DocsLayout.vue b/apps/www/.vitepress/theme/layout/DocsLayout.vue index 39232e19..989f856a 100644 --- a/apps/www/.vitepress/theme/layout/DocsLayout.vue +++ b/apps/www/.vitepress/theme/layout/DocsLayout.vue @@ -2,13 +2,15 @@ import { useData, useRoute } from 'vitepress' import { docsConfig } from '../config/docs' import TableOfContentVue from '../components/TableOfContent.vue' +import EditLink from '../components/EditLink.vue' import { ScrollArea } from '@/lib/registry/default/ui/scroll-area' import { Badge } from '@/lib/registry/default/ui/badge' import RadixIconsCode from '~icons/radix-icons/code' import ChevronRightIcon from '~icons/lucide/chevron-right' const $route = useRoute() -const { frontmatter } = useData() +const { frontmatter, ...a } = useData() +console.log(a)