完成单页初版本开发

This commit is contained in:
tangly1024
2022-02-27 21:16:13 +08:00
parent 7b49d5de11
commit 53c51846ef
5 changed files with 29 additions and 72 deletions

View File

@@ -36,7 +36,6 @@ export async function getAllPosts ({ notionPageData, from, pageType }) {
properties.fullWidth = pageBlock[id].value?.format?.page_full_width ?? false
properties.page_cover = getPostCover(id, pageBlock) ?? null
properties.content = pageBlock[id].value?.content ?? []
properties.icon = pageBlock[id].value?.icon ?? null
properties.tagItems = properties?.tags?.map(tag => {
return { name: tag, color: tagOptions.find(t => t.value === tag)?.color || 'gray' }
}) || []
@@ -74,3 +73,19 @@ function getPostCover (id, block) {
if (pageCover.startsWith('http')) return defaultMapImageUrl(pageCover, block[id].value)
}
}
/**
* 获取博文总数
* @param {*} param0
* @returns
*/
export async function getAllPostCount ({ notionPageData, from }) {
if (!notionPageData) {
notionPageData = await getNotionPageData({ from })
}
if (!notionPageData) {
return []
}
const allPosts = await getAllPosts({ notionPageData, from, pageType: ['Post'] })
return allPosts?.length || 0
}