mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-24 07:26:50 +00:00
微调组件,首页和博客页分离
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { getAllPosts, getAllTags } from '@/lib/notion'
|
||||
import DefaultLayout from '@/layouts/DefaultLayout'
|
||||
import IndexLayout from '@/layouts/IndexLayout'
|
||||
|
||||
export async function getStaticProps () {
|
||||
let posts = await getAllPosts()
|
||||
@@ -18,10 +18,10 @@ export async function getStaticProps () {
|
||||
}
|
||||
}
|
||||
|
||||
const blog = ({ posts, page, tags }) => {
|
||||
const index = ({ posts, page, tags }) => {
|
||||
return (
|
||||
<DefaultLayout tags={tags} posts={posts} page={page} />
|
||||
<IndexLayout tags={tags} posts={posts} page={page} />
|
||||
)
|
||||
}
|
||||
|
||||
export default blog
|
||||
export default index
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getAllPosts, getAllTags } from '@/lib/notion'
|
||||
import BLOG from '@/blog.config'
|
||||
import DefaultLayout from '@/layouts/DefaultLayout'
|
||||
import { useRouter } from 'next/router'
|
||||
import PageLayout from '@/layouts/PageLayout'
|
||||
|
||||
const Page = ({ posts, tags, page }) => {
|
||||
let filteredBlogPosts = posts
|
||||
@@ -16,7 +16,7 @@ const Page = ({ posts, tags, page }) => {
|
||||
}
|
||||
}
|
||||
|
||||
return <DefaultLayout tags={tags} posts={filteredBlogPosts} page={page} />
|
||||
return <PageLayout tags={tags} posts={filteredBlogPosts} page={page} />
|
||||
}
|
||||
|
||||
export async function getStaticProps (context) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { getAllPosts, getAllTags } from '@/lib/notion'
|
||||
import DefaultLayout from '@/layouts/DefaultLayout'
|
||||
import IndexLayout from '@/layouts/IndexLayout'
|
||||
import BLOG from '@/blog.config'
|
||||
|
||||
export default function Tag ({ tags, posts, currentTag }) {
|
||||
return <DefaultLayout tags={tags} posts={posts} currentTag={currentTag} />
|
||||
return <IndexLayout tags={tags} posts={posts} currentTag={currentTag} />
|
||||
}
|
||||
|
||||
export async function getStaticProps ({ params }) {
|
||||
|
||||
Reference in New Issue
Block a user