mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-19 15:09:36 +00:00
@@ -78,7 +78,7 @@ export default async function getPageProperties(id, block, schema, authToken, ta
|
|||||||
|
|
||||||
// 开启伪静态路径
|
// 开启伪静态路径
|
||||||
if (BLOG.PSEUDO_STATIC) {
|
if (BLOG.PSEUDO_STATIC) {
|
||||||
if (!properties.slug.endsWith('.html')) {
|
if (!properties?.slug?.endsWith('.html') && !properties?.slug?.startsWith('http')) {
|
||||||
properties.slug += '.html'
|
properties.slug += '.html'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,14 +124,17 @@ export async function getStaticProps({ params: { slug } }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const allPosts = props.allPages.filter(page => page.type === 'Post' && page.status === 'Published')
|
const allPosts = props.allPages.filter(page => page.type === 'Post' && page.status === 'Published')
|
||||||
const index = allPosts.indexOf(props.post)
|
if (allPosts && allPosts.length > 0) {
|
||||||
props.prev = allPosts.slice(index - 1, index)[0] ?? allPosts.slice(-1)[0]
|
const index = allPosts.indexOf(props.post)
|
||||||
props.next = allPosts.slice(index + 1, index + 2)[0] ?? allPosts[0]
|
props.prev = allPosts.slice(index - 1, index)[0] ?? allPosts.slice(-1)[0]
|
||||||
props.recommendPosts = getRecommendPost(
|
props.next = allPosts.slice(index + 1, index + 2)[0] ?? allPosts[0]
|
||||||
props.post,
|
props.recommendPosts = getRecommendPost(props.post, allPosts, BLOG.POST_RECOMMEND_COUNT)
|
||||||
allPosts,
|
} else {
|
||||||
BLOG.POST_RECOMMEND_COUNT
|
props.prev = null
|
||||||
)
|
props.next = null
|
||||||
|
props.recommendPosts = []
|
||||||
|
}
|
||||||
|
|
||||||
delete props.allPages
|
delete props.allPages
|
||||||
return {
|
return {
|
||||||
props,
|
props,
|
||||||
|
|||||||
Reference in New Issue
Block a user