Skip to content

Commit eb62cab

Browse files
committed
slug 支持 %category% 变量
1 parent 651f637 commit eb62cab

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/notion/getPageProperties.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ function mapProperties(properties) {
205205
/**
206206
* 获取自定义URL
207207
* 可以根据变量生成URL
208-
* 支持:%year%/%month%/%day%/%slug%
208+
* 支持:%category%/%year%/%month%/%day%/%slug%
209209
* @param {*} postProperties
210210
* @returns
211211
*/
@@ -227,6 +227,8 @@ function generateCustomizeSlug(postProperties) {
227227
fullPrefix += String(formatPostCreatedDate.getUTCDate()).padStart(2, 0)
228228
} else if (pattern === '%slug%') {
229229
fullPrefix += postProperties.slug ?? postProperties.id
230+
} else if (pattern === '%category%' && postProperties?.category) {
231+
fullPrefix += postProperties.category
230232
} else if (!pattern.includes('%')) {
231233
fullPrefix += pattern
232234
} else {

0 commit comments

Comments
 (0)