diff --git a/docs/notes/theme/config/frontmatter/basic.md b/docs/notes/theme/config/frontmatter/basic.md index c2eab3e9..06d70db1 100644 --- a/docs/notes/theme/config/frontmatter/basic.md +++ b/docs/notes/theme/config/frontmatter/basic.md @@ -3,6 +3,7 @@ title: 通用配置 author: pengzhanbo createTime: 2024/03/02 20:01:09 permalink: /config/frontmatter/basic/ +badge: 徽章 badge --- ## 概述 @@ -14,7 +15,6 @@ permalink: /config/frontmatter/basic/ ```md --- title: 标题 -author: 作者 createTime: 2024/03/02 20:01:09 permalink: /config/frontmatter/basic/ --- @@ -56,6 +56,12 @@ permalink: /config/frontmatter/basic/ 主题会在文件创建时,自动填充 当前文件名作为 文章标题。 +### badge + +- 类型: `string | { text: string, type?: 'info' | 'tip' | 'warning' | 'danger' }` + +在文章标题右侧显示 徽章。 + ### createTime - 类型: `string` diff --git a/docs/notes/theme/guide/组件/轮播图.md b/docs/notes/theme/guide/组件/轮播图.md index 218afdfc..99bb8e8a 100644 --- a/docs/notes/theme/guide/组件/轮播图.md +++ b/docs/notes/theme/guide/组件/轮播图.md @@ -3,6 +3,7 @@ title: 轮播图 icon: dashicons:images-alt2 createTime: 2024/09/12 22:00:22 permalink: /guide/components/swiper/ +badge: v1.0.0-rc.98 + --- ## 概述 diff --git a/theme/src/client/components/VPDocMeta.vue b/theme/src/client/components/VPDocMeta.vue index 2af174aa..6fc036f5 100644 --- a/theme/src/client/components/VPDocMeta.vue +++ b/theme/src/client/components/VPDocMeta.vue @@ -1,4 +1,5 @@ {{ page.title }} + diff --git a/theme/src/node/config/extendsBundlerOptions.ts b/theme/src/node/config/extendsBundlerOptions.ts index 4b2a556f..bc8eb43d 100644 --- a/theme/src/node/config/extendsBundlerOptions.ts +++ b/theme/src/node/config/extendsBundlerOptions.ts @@ -25,7 +25,7 @@ export function extendsBundlerOptions(bundlerOptions: any, app: App): void { ]) if (isPackageExists('swiper')) { - addViteOptimizeDepsInclude(bundlerOptions, app, ['swiper/modules', 'swiper/vue'], true) + addViteOptimizeDepsInclude(bundlerOptions, app, ['swiper/modules', 'swiper/vue']) addViteSsrNoExternal(bundlerOptions, app, ['swiper']) } diff --git a/theme/src/shared/frontmatter/post.ts b/theme/src/shared/frontmatter/post.ts index 577c8211..43c18052 100644 --- a/theme/src/shared/frontmatter/post.ts +++ b/theme/src/shared/frontmatter/post.ts @@ -17,4 +17,12 @@ export interface PlumeThemePostFrontmatter extends PlumeThemePageFrontmatter { * @default false */ draft?: boolean + + /** + * 标题徽章 + */ + badge?: string | { + text: string + type?: 'info' | 'tip' | 'warning' | 'danger' + } }
diff --git a/theme/src/node/config/extendsBundlerOptions.ts b/theme/src/node/config/extendsBundlerOptions.ts index 4b2a556f..bc8eb43d 100644 --- a/theme/src/node/config/extendsBundlerOptions.ts +++ b/theme/src/node/config/extendsBundlerOptions.ts @@ -25,7 +25,7 @@ export function extendsBundlerOptions(bundlerOptions: any, app: App): void { ]) if (isPackageExists('swiper')) { - addViteOptimizeDepsInclude(bundlerOptions, app, ['swiper/modules', 'swiper/vue'], true) + addViteOptimizeDepsInclude(bundlerOptions, app, ['swiper/modules', 'swiper/vue']) addViteSsrNoExternal(bundlerOptions, app, ['swiper']) } diff --git a/theme/src/shared/frontmatter/post.ts b/theme/src/shared/frontmatter/post.ts index 577c8211..43c18052 100644 --- a/theme/src/shared/frontmatter/post.ts +++ b/theme/src/shared/frontmatter/post.ts @@ -17,4 +17,12 @@ export interface PlumeThemePostFrontmatter extends PlumeThemePageFrontmatter { * @default false */ draft?: boolean + + /** + * 标题徽章 + */ + badge?: string | { + text: string + type?: 'info' | 'tip' | 'warning' | 'danger' + } }