feat: 在config中可自定义修改Notion数据库属性名

This commit is contained in:
jenson
2022-09-09 14:54:36 +08:00
parent 84d2ad21b7
commit 0bb0307bee
3 changed files with 21 additions and 2 deletions

View File

@@ -58,7 +58,13 @@ async function getPageProperties(id, block, schema, authToken, tagOptions, siteI
}
}
}
// 设置自定义字段
const fieldNames = BLOG.NOTION_PROPERTY_NAME
if (fieldNames) {
Object.keys(fieldNames).forEach(key => {
if (fieldNames[key] && properties[fieldNames[key]]) properties[key] = properties[fieldNames[key]]
})
}
properties.slug = properties.slug ?? properties.id
properties.createdTime = formatDate(new Date(value.created_time).toString(), BLOG.LANG)
properties.lastEditedTime = formatDate(new Date(value?.last_edited_time).toString(), BLOG.LANG)