mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-17 07:26:46 +00:00
修复编译问题
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user