From 3b4482d0f1177d29a5ea1b6606a009be5308a3d2 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Sat, 13 Jul 2024 05:45:28 +0800 Subject: [PATCH 1/4] chore: tweak --- theme/src/shared/page-data.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/theme/src/shared/page-data.ts b/theme/src/shared/page-data.ts index 274a6e0e..a22694cf 100644 --- a/theme/src/shared/page-data.ts +++ b/theme/src/shared/page-data.ts @@ -8,8 +8,7 @@ interface ReadingTime { } export interface PlumeThemePageData extends GitPluginPageData { - isBlogPost: boolean - type: 'blog' | 'friends' | 'blog-tags' | 'blog-archives' + type: 'blog' | 'friends' | 'blog-tags' | 'blog-archives' | 'blog-categories' categoryList?: PageCategoryData[] filePathRelative: string | null readingTime?: ReadingTime From 6b3c2cd8bb6ee5879dde66629e960764cba1758f Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Sat, 13 Jul 2024 14:35:50 +0800 Subject: [PATCH 2/4] chore: tweak --- theme/src/node/config/resolveLocaleOptions.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/theme/src/node/config/resolveLocaleOptions.ts b/theme/src/node/config/resolveLocaleOptions.ts index 97764b40..8e79491a 100644 --- a/theme/src/node/config/resolveLocaleOptions.ts +++ b/theme/src/node/config/resolveLocaleOptions.ts @@ -7,7 +7,16 @@ import { THEME_NAME } from '../utils/index.js' const FALLBACK_OPTIONS: PlumeThemeLocaleData = { appearance: true, - blog: { link: '/blog/', pagination: { perPage: 15 }, tags: true, archives: true, tagsLink: '/blog/tags/', archivesLink: '/blog/archives/' }, + blog: { + link: '/blog/', + pagination: { perPage: 15 }, + tags: true, + archives: true, + categories: true, + tagsLink: '/blog/tags/', + archivesLink: '/blog/archives/', + categoriesLink: '/blog/categories/', + }, article: '/article/', notes: { link: '/', dir: '/notes/', notes: [] }, navbarSocialInclude: ['github', 'twitter', 'discord', 'facebook'], From 7efa63fe319dfcc91fce2e3956e4ab6d889e56b8 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Sun, 14 Jul 2024 03:07:45 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix(theme):=20=E4=BF=AE=E5=A4=8D=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E8=B7=B3=E8=BD=AC=E5=8F=82=E6=95=B0=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- theme/src/client/components/VPButton.vue | 2 +- theme/src/client/components/VPLink.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/theme/src/client/components/VPButton.vue b/theme/src/client/components/VPButton.vue index 34d89d98..a54c72ae 100644 --- a/theme/src/client/components/VPButton.vue +++ b/theme/src/client/components/VPButton.vue @@ -32,7 +32,7 @@ function linkTo(e: Event) { if (!isExternal.value) { e.preventDefault() if (link.value) - router.push({ path: link.value }) + router.push(link.value) } } diff --git a/theme/src/client/components/VPLink.vue b/theme/src/client/components/VPLink.vue index 6b3dfc59..0f31ec12 100644 --- a/theme/src/client/components/VPLink.vue +++ b/theme/src/client/components/VPLink.vue @@ -21,7 +21,7 @@ function linkTo(e: Event) { if (!isExternal.value) { e.preventDefault() if (link.value) - router.push({ path: link.value }) + router.push(link.value) } } From c1a4d586b482a5c0196f3a3dab59d081512434a6 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Sun, 14 Jul 2024 03:10:29 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat(theme):=20=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E6=96=87=E7=AB=A0=E5=88=86=E7=B1=BB=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/notes.ts | 4 +- docs/notes/theme/config/主题配置.md | 6 + docs/notes/theme/guide/博客.md | 6 +- theme/src/client/components/Blog/VPBlog.vue | 9 ++ .../client/components/Blog/VPBlogArchives.vue | 6 +- .../components/Blog/VPBlogCategories.vue | 81 ++++++++++++ .../client/components/Blog/VPBlogExtract.vue | 6 +- .../src/client/components/Blog/VPBlogNav.vue | 12 +- .../src/client/components/Blog/VPBlogTags.vue | 6 +- .../client/components/Blog/VPCategories.vue | 60 +++++++++ .../components/Blog/VPCategoriesGroup.vue | 115 ++++++++++++++++++ .../src/client/components/Blog/VPPostItem.vue | 15 ++- theme/src/client/components/Nav/VPNav.vue | 2 +- .../src/client/components/Nav/VPNavScreen.vue | 2 +- theme/src/client/components/VPContent.vue | 2 +- theme/src/client/components/VPDoc.vue | 4 +- theme/src/client/components/VPDocMeta.vue | 16 ++- theme/src/client/components/VPLocalNav.vue | 12 +- theme/src/client/composables/blog-archives.ts | 2 +- theme/src/client/composables/blog-category.ts | 69 +++++++++++ theme/src/client/composables/blog-data.ts | 10 +- theme/src/client/composables/blog-extract.ts | 38 +++++- .../src/client/composables/blog-post-list.ts | 9 +- theme/src/client/composables/blog-tags.ts | 2 +- theme/src/client/composables/index.ts | 2 + theme/src/client/composables/langs.ts | 4 +- theme/src/client/composables/page.ts | 16 +++ theme/src/client/composables/prev-next.ts | 12 +- theme/src/client/styles/icons.css | 16 +++ theme/src/node/locales/en.ts | 1 + theme/src/node/locales/zh.ts | 1 + theme/src/node/setupPages.ts | 64 +++------- theme/src/shared/base.ts | 1 + theme/src/shared/blog.ts | 13 ++ theme/src/shared/page-data.ts | 3 +- 35 files changed, 527 insertions(+), 100 deletions(-) create mode 100644 theme/src/client/components/Blog/VPBlogCategories.vue create mode 100644 theme/src/client/components/Blog/VPCategories.vue create mode 100644 theme/src/client/components/Blog/VPCategoriesGroup.vue create mode 100644 theme/src/client/composables/blog-category.ts create mode 100644 theme/src/client/composables/page.ts diff --git a/docs/.vuepress/notes.ts b/docs/.vuepress/notes.ts index 35cb8773..64627dad 100644 --- a/docs/.vuepress/notes.ts +++ b/docs/.vuepress/notes.ts @@ -116,8 +116,8 @@ export const zhNotes = definePlumeNotesConfig({ { text: 'plugin-netlify-functions', dir: 'netlify-functions', - link: 'plugin-netlify-functions/', - collapsed: false, + link: '/plugins/plugin-netlify-functions/', + collapsed: true, items: [ '介绍', '使用', diff --git a/docs/notes/theme/config/主题配置.md b/docs/notes/theme/config/主题配置.md index 4304398f..7c818f00 100644 --- a/docs/notes/theme/config/主题配置.md +++ b/docs/notes/theme/config/主题配置.md @@ -98,6 +98,12 @@ interface BlogOptions { * @default true */ archives?: boolean + + /** + * 是否启用分类页 + * @default true + */ + categories?: boolean } ``` diff --git a/docs/notes/theme/guide/博客.md b/docs/notes/theme/guide/博客.md index 369c0800..808189c3 100644 --- a/docs/notes/theme/guide/博客.md +++ b/docs/notes/theme/guide/博客.md @@ -110,10 +110,12 @@ title: 标题 这里的内容不会被作为摘要 ``` -## 标签页和归档页 +## 标签页,分类页和归档页 -主题除了自动生成 **博客文章列表页** 以外,还会自动生成 **标签页** 和 **归档页**。 +主题除了自动生成 **博客文章列表页** 以外,还会自动生成 **标签页**,**分类页** 和 **归档页**。 标签页 可以根据 标签 筛选并展示 博客文章。 +分类页 可以根据 原始目录结构 分类展示 博客文章。 + 归档页根据文章的创建时间进行归档。 diff --git a/theme/src/client/components/Blog/VPBlog.vue b/theme/src/client/components/Blog/VPBlog.vue index 4e4dbc92..8909ba82 100644 --- a/theme/src/client/components/Blog/VPBlog.vue +++ b/theme/src/client/components/Blog/VPBlog.vue @@ -4,6 +4,7 @@ import VPBlogArchives from '@theme/Blog/VPBlogArchives.vue' import VPBlogAside from '@theme/Blog/VPBlogAside.vue' import VPBlogExtract from '@theme/Blog/VPBlogExtract.vue' import VPBlogTags from '@theme/Blog/VPBlogTags.vue' +import VPBlogCategories from '@theme/Blog/VPBlogCategories.vue' import VPBlogNav from '@theme/Blog/VPBlogNav.vue' import VPTransitionFadeSlideY from '@theme/VPTransitionFadeSlideY.vue' import { useData } from '../../composables/data.js' @@ -35,6 +36,14 @@ const { theme, page } = useData() + + + +