分类、标签页面的最新文章列表
This commit is contained in:
tangly1024
2021-12-01 13:33:47 +08:00
parent 3d02abf98e
commit 192fc72f69
2 changed files with 10 additions and 8 deletions

View File

@@ -7,18 +7,18 @@ import React from 'react'
import CategoryList from '@/components/CategoryList' import CategoryList from '@/components/CategoryList'
import { getNotionPageData } from '@/lib/notion/getNotionData' import { getNotionPageData } from '@/lib/notion/getNotionData'
export default function Category ({ tags, posts, category, categories }) { export default function Category ({ tags, allPosts, filteredPosts, category, categories }) {
const meta = { const meta = {
title: `${BLOG.title} | ${category}`, title: `${BLOG.title} | ${category}`,
description: BLOG.description, description: BLOG.description,
type: 'website' type: 'website'
} }
return <BaseLayout meta={meta} tags={tags} currentCategory={category} totalPosts={posts} categories={categories}> return <BaseLayout meta={meta} tags={tags} currentCategory={category} totalPosts={allPosts} categories={categories}>
<div className='flex-grow bg-gray-200 dark:bg-black shadow-inner'> <div className='flex-grow bg-gray-200 dark:bg-black shadow-inner'>
<StickyBar > <StickyBar >
<CategoryList currentCategory={category} categories={categories} /> <CategoryList currentCategory={category} categories={categories} />
</StickyBar> </StickyBar>
<BlogPostListScroll posts={posts} tags={tags} currentCategory={category}/> <BlogPostListScroll posts={filteredPosts} tags={tags} currentCategory={category}/>
</div> </div>
</BaseLayout> </BaseLayout>
} }
@@ -37,7 +37,8 @@ export async function getStaticProps ({ params }) {
return { return {
props: { props: {
tags, tags,
posts: filteredPosts, allPosts,
filteredPosts,
category, category,
categories categories
}, },

View File

@@ -6,18 +6,18 @@ import BlogPostListScroll from '@/components/BlogPostListScroll'
import TagList from '@/components/TagList' import TagList from '@/components/TagList'
import { getNotionPageData } from '@/lib/notion/getNotionData' import { getNotionPageData } from '@/lib/notion/getNotionData'
export default function Tag ({ tags, posts, currentTag, categories }) { export default function Tag ({ tags, allPosts, filteredPosts, currentTag, categories }) {
const meta = { const meta = {
title: `${BLOG.title} | #${currentTag}`, title: `${BLOG.title} | #${currentTag}`,
description: BLOG.description, description: BLOG.description,
type: 'website' type: 'website'
} }
return <BaseLayout meta={meta} tags={tags} currentTag={currentTag} categories={categories} totalPosts={posts}> return <BaseLayout meta={meta} tags={tags} currentTag={currentTag} categories={categories} totalPosts={allPosts}>
<div className='flex-grow bg-gray-200 dark:bg-black shadow-inner'> <div className='flex-grow bg-gray-200 dark:bg-black shadow-inner'>
<StickyBar> <StickyBar>
<TagList tags={tags} currentTag={currentTag}/> <TagList tags={tags} currentTag={currentTag}/>
</StickyBar> </StickyBar>
<BlogPostListScroll posts={posts} tags={tags} currentTag={currentTag}/> <BlogPostListScroll posts={filteredPosts} tags={tags} currentTag={currentTag}/>
</div> </div>
</BaseLayout> </BaseLayout>
} }
@@ -36,7 +36,8 @@ export async function getStaticProps ({ params }) {
return { return {
props: { props: {
tags, tags,
posts: filteredPosts, allPosts,
filteredPosts,
currentTag, currentTag,
categories categories
}, },