mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
修复隐藏文章显示问题
This commit is contained in:
@@ -257,7 +257,7 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) {
|
||||
let postCount = 0
|
||||
|
||||
const allPages = collectionData.filter(post => {
|
||||
if (post.type === 'Post' && (post.status === 'Published' || post.status === 'Invisible')) {
|
||||
if (post.type === 'Post' && post.status === 'Published') {
|
||||
postCount++
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ export async function getStaticProps({ params: { slug } }) {
|
||||
// slug 是个数组
|
||||
const fullSlug = slug.join('/')
|
||||
const from = `slug-props-${fullSlug}`
|
||||
const props = await getGlobalNotionData({ from, pageType: ['Post'] })
|
||||
const props = await getGlobalNotionData({ from })
|
||||
props.post = props.allPages.find((p) => {
|
||||
return p.slug === fullSlug || p.id === idToUuid(fullSlug)
|
||||
})
|
||||
|
||||
@@ -21,7 +21,7 @@ const ArchiveIndex = props => {
|
||||
export async function getStaticProps() {
|
||||
const props = await getGlobalNotionData({ from: 'archive-index' })
|
||||
const { allPages } = props
|
||||
const allPosts = allPages.filter(page => page.type === 'Post')
|
||||
const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published')
|
||||
// 处理分页
|
||||
props.posts = allPosts
|
||||
return {
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function getStaticProps({ params: { category } }) {
|
||||
const from = 'category-props'
|
||||
let props = await getGlobalNotionData({ from })
|
||||
const { allPages } = props
|
||||
const allPosts = allPages.filter(page => page.type === 'Post')
|
||||
const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published')
|
||||
const posts = allPosts.filter(
|
||||
post => post && post.category && post.category.includes(category)
|
||||
)
|
||||
|
||||
@@ -13,7 +13,7 @@ export async function getStaticProps() {
|
||||
const from = 'index'
|
||||
const props = await getGlobalNotionData({ from })
|
||||
const { allPages, siteInfo } = props
|
||||
const allPosts = allPages.filter(page => page.type === 'Post')
|
||||
const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published')
|
||||
const meta = {
|
||||
title: `${siteInfo?.title} | ${siteInfo?.description}`,
|
||||
description: siteInfo?.description,
|
||||
|
||||
@@ -39,7 +39,7 @@ export async function getStaticProps({ params: { page } }) {
|
||||
const props = await getGlobalNotionData({ from })
|
||||
props.page = page
|
||||
const { allPages } = props
|
||||
const allPosts = allPages.filter(page => page.type === 'Post')
|
||||
const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published')
|
||||
// 处理分页
|
||||
props.posts = allPosts.slice(
|
||||
BLOG.POSTS_PER_PAGE * (page - 1),
|
||||
|
||||
@@ -36,7 +36,7 @@ export async function getStaticProps({ params: { keyword } }) {
|
||||
pageType: ['Post']
|
||||
})
|
||||
const { allPages } = props
|
||||
const allPosts = allPages.filter(page => page.type === 'Post')
|
||||
const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published')
|
||||
props.posts = await filterByMemCache(allPosts, keyword)
|
||||
props.keyword = keyword
|
||||
return {
|
||||
|
||||
@@ -53,7 +53,7 @@ export async function getStaticProps() {
|
||||
pageType: ['Post']
|
||||
})
|
||||
const { allPages } = props
|
||||
const allPosts = allPages.filter(page => page.type === 'Post')
|
||||
const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published')
|
||||
props.posts = allPosts
|
||||
return {
|
||||
props,
|
||||
|
||||
@@ -29,7 +29,7 @@ export async function getStaticProps({ params: { tag } }) {
|
||||
tagsCount: 0
|
||||
})
|
||||
const { allPages } = props
|
||||
const allPosts = allPages.filter(page => page.type === 'Post')
|
||||
const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published')
|
||||
props.posts = allPosts.filter(
|
||||
post => post && post.tags && post.tags.includes(tag)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user