diff --git a/package.json b/package.json index d136b1503f..7b0b60bd11 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "vuepress-plugin-one-click-copy": "^1.0.2", "vuepress-plugin-thirdparty-search": "^1.0.2", "vuepress-plugin-zooming": "^1.1.7", - "vuepress-theme-vdoing": "^1.12.4", + "vuepress-theme-vdoing": "^1.12.5", "yamljs": "^0.3.0" } } diff --git a/vdoing/node_utils/setFrontmatter.js b/vdoing/node_utils/setFrontmatter.js index ea5c8ca07d..e3a57167fb 100644 --- a/vdoing/node_utils/setFrontmatter.js +++ b/vdoing/node_utils/setFrontmatter.js @@ -143,7 +143,16 @@ function getCategories(file, categoryText) { } } } else { - categories.push(categoryText) + // 碎片化文章的分类生成 + const matchResult = file.filePath.match(/_posts\/(\S*)\//); + const resultStr = matchResult ? matchResult[1] : '' + const resultArr = resultStr.split('/').filter(Boolean) + + if (resultArr.length) { + categories.push(...resultArr) + } else { + categories.push(categoryText) + } } return categories } diff --git a/vdoing/package.json b/vdoing/package.json index 5360cfc4de..1dd4253ffe 100644 --- a/vdoing/package.json +++ b/vdoing/package.json @@ -1,6 +1,6 @@ { "name": "vuepress-theme-vdoing", - "version": "1.12.4", + "version": "1.12.5", "description": "Vdoing theme for VuePress. 一个基于VuePress的知识管理兼博客主题。", "author": { "name": "gaoyi(Evan) Xu"