修复编译问题

This commit is contained in:
tangly
2022-10-18 16:42:55 +08:00
parent 1fcafeb214
commit c80450c410
7 changed files with 20 additions and 8 deletions

View File

@@ -11,10 +11,10 @@ export default function getAllPageIds (collectionQuery, collectionId, collection
view?.collection_group_results?.blockIds?.forEach(id => pageSet.add(id)) // table视图
})
pageIds = [...pageSet]
console.log('PageIds: 从collectionQuery获取', collectionQuery, pageIds.length)
// console.log('PageIds: 从collectionQuery获取', collectionQuery, pageIds.length)
} else if (viewIds && viewIds.length > 0) {
const ids = collectionView[viewIds[0]].value.page_sort
console.log('PageIds: 从viewId获取', viewIds)
// console.log('PageIds: 从viewId获取', viewIds)
for (const id of ids) {
pageIds.push(id)
}

View File

@@ -20,7 +20,10 @@ const ArchiveIndex = props => {
export async function getStaticProps() {
const props = await getGlobalNotionData({ from: 'archive-index' })
props.posts = props.allPosts
const { allPages } = props
const allPosts = allPages.filter(page => page.type === 'Post')
// 处理分页
props.posts = allPosts
return {
props,
revalidate: 1

View File

@@ -26,7 +26,9 @@ export default function Category(props) {
export async function getStaticProps({ params: { category } }) {
const from = 'category-props'
let props = await getGlobalNotionData({ from })
const posts = props.allPosts.filter(
const { allPages } = props
const allPosts = allPages.filter(page => page.type === 'Post')
const posts = allPosts.filter(
post => post && post.category && post.category.includes(category)
)
props = { ...props, posts, category }

View File

@@ -38,8 +38,10 @@ export async function getStaticProps({ params: { page } }) {
const from = `page-${page}`
const props = await getGlobalNotionData({ from })
props.page = page
const { allPages } = props
const allPosts = allPages.filter(page => page.type === 'Post')
// 处理分页
props.posts = props.allPosts.slice(
props.posts = allPosts.slice(
BLOG.POSTS_PER_PAGE * (page - 1),
BLOG.POSTS_PER_PAGE * page
)

View File

@@ -35,7 +35,9 @@ export async function getStaticProps({ params: { keyword } }) {
from: 'search-props',
pageType: ['Post']
})
props.posts = await filterByMemCache(props.allPosts, keyword)
const { allPages } = props
const allPosts = allPages.filter(page => page.type === 'Post')
props.posts = await filterByMemCache(allPosts, keyword)
props.keyword = keyword
return {
props,

View File

@@ -52,7 +52,9 @@ export async function getStaticProps() {
from: 'search-props',
pageType: ['Post']
})
props.posts = props.allPosts
const { allPages } = props
const allPosts = allPages.filter(page => page.type === 'Post')
props.posts = allPosts
return {
props,
revalidate: 1

View File

@@ -28,7 +28,8 @@ export async function getStaticProps({ params: { tag } }) {
includePage: false,
tagsCount: 0
})
const { allPosts } = props
const { allPages } = props
const allPosts = allPages.filter(page => page.type === 'Post')
props.posts = allPosts.filter(
post => post && post.tags && post.tags.includes(tag)
)