lastEditTime 字段名调整;修改algolia逻辑

This commit is contained in:
tangly1024
2023-07-29 16:38:49 +08:00
parent c13eb5e65e
commit 7841b556d6
39 changed files with 148 additions and 80 deletions

View File

@@ -25,7 +25,8 @@ export async function getGlobalData({
from
}) {
// 从notion获取
const db = deepClone(await getNotionPageData({ pageId, from }))
const data = await getNotionPageData({ pageId, from })
const db = deepClone(data)
// 不返回的敏感数据
delete db.block
delete db.schema
@@ -48,8 +49,8 @@ function getLatestPosts({ allPages, from, latestPostCount }) {
const allPosts = allPages?.filter(page => page.type === 'Post' && page.status === 'Published')
const latestPosts = Object.create(allPosts).sort((a, b) => {
const dateA = new Date(a?.lastEditedTime || a?.publishDate)
const dateB = new Date(b?.lastEditedTime || b?.publishDate)
const dateA = new Date(a?.lastEditedDay || a?.publishDate)
const dateB = new Date(b?.lastEditedDay || b?.publishDate)
return dateB - dateA
})
return latestPosts.slice(0, latestPostCount)
@@ -217,7 +218,7 @@ const EmptyData = (pageId) => {
const empty = {
notice: null,
siteInfo: getSiteInfo({}),
allPages: [{ id: 1, title: `无法获取Notion数据请检查Notion_ID \n 当前 ${pageId}`, summary: '访问文档获取帮助→ https://tangly1024.com/article/vercel-deploy-notion-next', status: 'Published', type: 'Post', slug: '13a171332816461db29d50e9f575b00d', date: { start_date: '2023-04-24', lastEditedTime: '2023-04-24', tagItems: [] } }],
allPages: [{ id: 1, title: `无法获取Notion数据请检查Notion_ID \n 当前 ${pageId}`, summary: '访问文档获取帮助→ https://tangly1024.com/article/vercel-deploy-notion-next', status: 'Published', type: 'Post', slug: '13a171332816461db29d50e9f575b00d', date: { start_date: '2023-04-24', lastEditedDay: '2023-04-24', tagItems: [] } }],
allNavPages: [],
collection: [],
collectionQuery: {},