Merge branch 'feat/next-theme-header-img' into develop

This commit is contained in:
tangly
2022-11-18 13:23:03 +08:00
5 changed files with 38 additions and 3 deletions

View File

@@ -79,6 +79,7 @@ export default async function getPageProperties(id, block, schema, authToken, ta
properties.createdTime = formatDate(new Date(value.created_time).toString(), BLOG.LANG)
properties.lastEditedTime = formatDate(new Date(value?.last_edited_time).toString(), BLOG.LANG)
properties.fullWidth = value.format?.page_full_width ?? false
properties.pageIcon = getPageIcon(id, block) ?? ''
properties.page_cover = getPostCover(id, block) ?? siteInfo?.pageCover
properties.content = value.content ?? []
properties.tagItems = properties?.tags?.map(tag => {
@@ -96,3 +97,12 @@ export default async function getPageProperties(id, block, schema, authToken, ta
}
}
}
function getPageIcon(id, block) {
const pageIcon = block[id].value?.format?.page_icon
if (pageIcon) {
if (pageIcon.startsWith('/')) return 'https://www.notion.so' + pageIcon
if (pageIcon.startsWith('http')) return defaultMapImageUrl(pageIcon, block[id].value)
return pageIcon
}
}