修复隐藏文章显示问题

This commit is contained in:
tangly
2022-10-20 13:01:32 +08:00
parent 9ddad487ec
commit cd233f5060
9 changed files with 9 additions and 9 deletions

View File

@@ -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++
}

View File

@@ -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)
})

View File

@@ -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 {

View File

@@ -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)
)

View File

@@ -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,

View File

@@ -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),

View File

@@ -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 {

View File

@@ -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,

View File

@@ -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)
)