feat: bigger page size

This commit is contained in:
KazooTTT
2024-10-09 17:52:42 +08:00
parent fbb9ed80ec
commit 950d014fdb
3 changed files with 4 additions and 4 deletions

View File

@ -15,7 +15,7 @@ export const getStaticPaths = (async ({ paginate }) => {
const allPostsByDate = sortMDByDate(allPosts) const allPostsByDate = sortMDByDate(allPosts)
const uniqueTags = getUniqueTags(allPosts) const uniqueTags = getUniqueTags(allPosts)
const uniqueCategories = getUniqueCategories(allPosts) const uniqueCategories = getUniqueCategories(allPosts)
return paginate(allPostsByDate, { pageSize: 10, props: { uniqueTags, uniqueCategories } }) return paginate(allPostsByDate, { pageSize: 20, props: { uniqueTags, uniqueCategories } })
}) satisfies GetStaticPaths }) satisfies GetStaticPaths
interface Props { interface Props {
@ -74,7 +74,7 @@ const paginationProps = {
<section aria-label='Blog posts list'> <section aria-label='Blog posts list'>
<ul class='flex flex-col gap-y-4 text-start'> <ul class='flex flex-col gap-y-4 text-start'>
{page.data.map((p) => ( {page.data.map((p) => (
<PostPreview post={p} /> <PostPreview post={p} />
))} ))}
</ul> </ul>
<Pagination {...paginationProps} /> <Pagination {...paginationProps} />

View File

@ -20,7 +20,7 @@ export const getStaticPaths: GetStaticPaths = async ({ paginate }) => {
category === '未分类' ? !post.data.category : post.data.category === category category === '未分类' ? !post.data.category : post.data.category === category
) )
return paginate(filterPosts, { return paginate(filterPosts, {
pageSize: 10, pageSize: 20,
params: { category } params: { category }
}) })
}) })

View File

@ -18,7 +18,7 @@ export const getStaticPaths: GetStaticPaths = async ({ paginate }) => {
return uniqueTags.flatMap((tag) => { return uniqueTags.flatMap((tag) => {
const filterPosts = allPostsByDate.filter((post) => post.data.tags.includes(tag)) const filterPosts = allPostsByDate.filter((post) => post.data.tags.includes(tag))
return paginate(filterPosts, { return paginate(filterPosts, {
pageSize: 10, pageSize: 20,
params: { tag } params: { tag }
}) })
}) })