Merge branch 'bug/hidden-page-navigator' into develop

This commit is contained in:
tangly
2022-11-18 13:23:28 +08:00

View File

@@ -115,7 +115,7 @@ export async function getStaticProps({ params: { slug } }) {
props.post.blockMap = await getPostBlocks(props.post.id, 'slug')
}
const allPosts = props.allPages.filter(page => page.type === 'Post')
const allPosts = props.allPages.filter(page => page.type === 'Post' && page.status === 'Published')
const index = allPosts.indexOf(props.post)
props.prev = allPosts.slice(index - 1, index)[0] ?? allPosts.slice(-1)[0]
props.next = allPosts.slice(index + 1, index + 2)[0] ?? allPosts[0]