mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-20 07:26:46 +00:00
feature:加入最新文章功能
This commit is contained in:
@@ -19,7 +19,7 @@ import Custom404 from '@/pages/404'
|
||||
const mapPageUrl = id => {
|
||||
return 'https://www.notion.so/' + id.replace(/-/g, '')
|
||||
}
|
||||
const BlogPost = ({ post, blockMap, tags, prev, next }) => {
|
||||
const BlogPost = ({ post, blockMap, tags, prev, next, posts }) => {
|
||||
if (!post) {
|
||||
return <Custom404/>
|
||||
}
|
||||
@@ -31,7 +31,7 @@ const BlogPost = ({ post, blockMap, tags, prev, next }) => {
|
||||
const targetRef = useRef(null)
|
||||
const url = BLOG.link + useRouter().asPath
|
||||
|
||||
return <BaseLayout meta={meta} tags={tags} post={post}>
|
||||
return <BaseLayout meta={meta} tags={tags} post={post} posts={posts}>
|
||||
{/* 阅读进度条 */}
|
||||
<Progress targetRef={targetRef} />
|
||||
|
||||
@@ -192,7 +192,7 @@ export async function getStaticProps ({ params: { slug } }) {
|
||||
const next = posts.slice(index + 1, index + 2)[0] ?? posts[0]
|
||||
|
||||
return {
|
||||
props: { post, blockMap, tags, prev, next },
|
||||
props: { post, blockMap, tags, prev, next, posts },
|
||||
revalidate: 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function getStaticProps () {
|
||||
|
||||
const Index = ({ posts, tags, meta }) => {
|
||||
return (
|
||||
<BaseLayout meta={meta} tags={tags}>
|
||||
<BaseLayout meta={meta} tags={tags} posts={posts}>
|
||||
<div className='flex-grow'>
|
||||
<TagsBar tags={tags} />
|
||||
<BlogPostListScroll posts={posts} tags={tags} />
|
||||
|
||||
Reference in New Issue
Block a user