From 04ada17d5f9fd273a4ef904ca4e31ec3df9d2f04 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Mon, 18 Nov 2024 00:42:13 +0800 Subject: [PATCH] feat(theme): add categories transform and improve ui (#342) --- docs/notes/theme/config/主题配置.md | 7 +++++++ theme/src/client/components/Blog/VPBlogNav.vue | 3 +++ theme/src/client/components/Blog/VPPostItem.vue | 8 ++------ theme/src/client/components/VPDocMeta.vue | 3 +-- theme/src/node/config/resolveThemeData.ts | 5 +++++ theme/src/node/pages/autoCategory.ts | 10 ++++++---- theme/src/shared/blog.ts | 10 +++++++++- 7 files changed, 33 insertions(+), 13 deletions(-) diff --git a/docs/notes/theme/config/主题配置.md b/docs/notes/theme/config/主题配置.md index e94436f3..e054349e 100644 --- a/docs/notes/theme/config/主题配置.md +++ b/docs/notes/theme/config/主题配置.md @@ -145,6 +145,13 @@ interface BlogOptions { */ categoriesExpand?: number | 'deep' + /** + * 文章分类列表转换函数,比如排除不需要的一级分类 + * @param categories 分类列表 + * @returns 返回一个新的分类列表 + */ + categoriesTransform?: (categories: PageCategoryData[]) => PageCategoryData[] + /** * 博客文章封面图 * diff --git a/theme/src/client/components/Blog/VPBlogNav.vue b/theme/src/client/components/Blog/VPBlogNav.vue index 9171ee7d..92a0c338 100644 --- a/theme/src/client/components/Blog/VPBlogNav.vue +++ b/theme/src/client/components/Blog/VPBlogNav.vue @@ -15,6 +15,7 @@ const { hasBlogExtract, tags, archives, categories } = useBlogExtract()