mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 15:09:22 +00:00
slug 支持 %category% 变量
This commit is contained in:
@@ -205,7 +205,7 @@ function mapProperties(properties) {
|
||||
/**
|
||||
* 获取自定义URL
|
||||
* 可以根据变量生成URL
|
||||
* 支持:%year%/%month%/%day%/%slug%
|
||||
* 支持:%category%/%year%/%month%/%day%/%slug%
|
||||
* @param {*} postProperties
|
||||
* @returns
|
||||
*/
|
||||
@@ -227,6 +227,8 @@ function generateCustomizeSlug(postProperties) {
|
||||
fullPrefix += String(formatPostCreatedDate.getUTCDate()).padStart(2, 0)
|
||||
} else if (pattern === '%slug%') {
|
||||
fullPrefix += postProperties.slug ?? postProperties.id
|
||||
} else if (pattern === '%category%' && postProperties?.category) {
|
||||
fullPrefix += postProperties.category
|
||||
} else if (!pattern.includes('%')) {
|
||||
fullPrefix += pattern
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user