Skip to content

Commit

Permalink
fix: #855 自动映射分类时才添加路径为分类
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Nov 4, 2023
1 parent c5dda53 commit cc2bb44
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/adaptors/base/baseExtendApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,18 @@ class BaseExtendApi extends WebApi implements IBlogApi, IWebApi {
// 自动映射分类
const autoDir = path.join(savePath.replace(CATE_AUTO_NAME, ""), save_dir)
post.cate_slugs = [autoDir]
}
// 笔记层级作为分类
const docPathArray = save_dir.split("/")
if (docPathArray.length > 1) {
for (let i = 1; i < docPathArray.length; i++) {
const docCate = HtmlUtil.removeTitleNumber(docPathArray[i])
pathCates.push(docCate)

// 笔记层级作为分类
const docPathArray = save_dir.split("/")
if (docPathArray.length > 1) {
for (let i = 1; i < docPathArray.length; i++) {
const docCate = HtmlUtil.removeTitleNumber(docPathArray[i])
pathCates.push(docCate)
}
}
}


// 目录分类
this.logger.info("目录路径转换的分类 =>", pathCates)
const mergedCategories = [...new Set([...(pathCates ?? []), ...(post?.categories ?? [])])].filter(
Expand Down

0 comments on commit cc2bb44

Please sign in to comment.