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