mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-04 07:26:47 +00:00
标题处理、标签页分页处理
This commit is contained in:
@@ -15,25 +15,12 @@ const Page = ({ posts, tags, page }) => {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return <PageLayout tags={tags} posts={filteredBlogPosts} page={page} />
|
||||
}
|
||||
|
||||
export async function getStaticProps (context) {
|
||||
const { page } = context.params // Get Current Page No.
|
||||
let posts = await getAllPosts()
|
||||
posts = posts.filter(
|
||||
post => post.status[0] === 'Published' && post.type[0] === 'Post'
|
||||
)
|
||||
const tags = await getAllTags(posts)
|
||||
return {
|
||||
props: {
|
||||
tags,
|
||||
posts,
|
||||
page
|
||||
},
|
||||
revalidate: 1
|
||||
const meta = {
|
||||
title: `${BLOG.title} | 博客列表`,
|
||||
description: BLOG.description,
|
||||
type: 'website'
|
||||
}
|
||||
return <PageLayout tags={tags} posts={filteredBlogPosts} page={page} meta={meta} />
|
||||
}
|
||||
|
||||
export async function getStaticPaths () {
|
||||
@@ -60,4 +47,21 @@ export async function getStaticPaths () {
|
||||
}
|
||||
}
|
||||
|
||||
export async function getStaticProps (context) {
|
||||
const { page } = context.params // Get Current Page No.
|
||||
let posts = await getAllPosts()
|
||||
posts = posts.filter(
|
||||
post => post.status[0] === 'Published' && post.type[0] === 'Post'
|
||||
)
|
||||
const tags = await getAllTags(posts)
|
||||
return {
|
||||
props: {
|
||||
tags,
|
||||
posts,
|
||||
page
|
||||
},
|
||||
revalidate: 1
|
||||
}
|
||||
}
|
||||
|
||||
export default Page
|
||||
|
||||
Reference in New Issue
Block a user