mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
slug,page 预渲染
This commit is contained in:
@@ -35,7 +35,7 @@ export async function getStaticPaths () {
|
||||
posts = await getAllPosts({ from: 'slug - paths', includePage: true })
|
||||
}
|
||||
return {
|
||||
paths: posts.map(row => `${BLOG.path}/article/${row.slug}`),
|
||||
paths: posts.map(row => ({ params: { slug: row.slug } })),
|
||||
fallback: true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,10 +28,10 @@ export async function getStaticPaths () {
|
||||
const from = 'page'
|
||||
const notionPageData = await getNotionPageData({ from })
|
||||
const allPosts = await getAllPosts({ notionPageData, from })
|
||||
const totalPages = Math.ceil(allPosts / BLOG.postsPerPage)
|
||||
const totalPages = Math.ceil(allPosts?.length / BLOG.postsPerPage)
|
||||
return {
|
||||
// remove first page, we 're not gonna handle that.
|
||||
paths: Array.from({ length: totalPages - 1 }, (_, i) => `/page/${(i + 2)}`),
|
||||
paths: Array.from({ length: totalPages - 1 }, (_, i) => ({ params: { page: '' + (i + 2) } })),
|
||||
fallback: true
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ export async function getStaticProps ({ params: { page } }) {
|
||||
const tagOptions = notionPageData.tagOptions
|
||||
const tags = await getAllTags({ allPosts, tagOptions })
|
||||
const meta = {
|
||||
title: `${BLOG.title}`,
|
||||
title: `Page ${page} |${BLOG.title}`,
|
||||
description: BLOG.description,
|
||||
type: 'website'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user