mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-04 23:16:53 +00:00
封装PageProperties 修复文章排序
This commit is contained in:
@@ -49,13 +49,14 @@ export async function getGlobalNotionData({
|
||||
*/
|
||||
function getLatestPosts({ allPosts, from, latestPostCount }) {
|
||||
const latestPosts = Object.create(allPosts).sort((a, b) => {
|
||||
console.log('排序过程', a, b)
|
||||
const dateA = new Date(a?.lastEditedTime || a?.createdTime || a?.date?.start_date)
|
||||
const dateB = new Date(b?.lastEditedTime || b?.createdTime || b?.date?.start_date)
|
||||
// const dateA = new Date(a.date?.start_date)
|
||||
// const dateB = new Date(b.date?.start_date)
|
||||
return dateB - dateA
|
||||
})
|
||||
|
||||
console.log('排序结果', latestPosts)
|
||||
return latestPosts.slice(0, latestPostCount)
|
||||
}
|
||||
|
||||
@@ -225,9 +226,11 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) {
|
||||
}
|
||||
for (let i = 0; i < pageIds.length; i++) {
|
||||
const id = pageIds[i]
|
||||
const properties = (await getPageProperties(id, block, schema)) || null
|
||||
properties.slug = properties.slug ?? properties.id
|
||||
delete properties.content
|
||||
const value = block[id]?.value
|
||||
if (!value) {
|
||||
continue
|
||||
}
|
||||
const properties = (await getPageProperties(id, block, schema, tagOptions)) || null
|
||||
data.push(properties)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user