feat: 修改分页大小以匹配全局配置

This commit is contained in:
KazooTTT
2025-04-15 16:46:46 +08:00
parent ece753d46b
commit a1fc14d838
2 changed files with 4 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import { getAllPosts, getUniqueCategories } from "@/data/post";
import PageLayout from "@/layouts/Base.astro";
import { collectionDateSort } from "@/utils/date";
import type { GetStaticPaths, Page } from "astro";
import { MAX_POSTS_PER_PAGE } from "@/utils/constant";
export const getStaticPaths: GetStaticPaths = async ({ paginate }) => {
const allPosts = await getAllPosts();
@ -17,7 +18,7 @@ export const getStaticPaths: GetStaticPaths = async ({ paginate }) => {
category === "未分类" ? !post.data.category : post.data.category === category
);
return paginate(filterPosts, {
pageSize: 20,
pageSize: MAX_POSTS_PER_PAGE,
params: { category },
});
});

View File

@ -6,6 +6,7 @@ import { getAllPosts, getUniqueTags } from "@/data/post";
import PageLayout from "@/layouts/Base.astro";
import { collectionDateSort } from "@/utils/date";
import type { GetStaticPaths, Page } from "astro";
import { MAX_CATEGORIES } from "@/utils/constant";
export const getStaticPaths: GetStaticPaths = async ({ paginate }) => {
const allPosts = await getAllPosts();
@ -15,7 +16,7 @@ export const getStaticPaths: GetStaticPaths = async ({ paginate }) => {
return uniqueTags.flatMap((tag) => {
const filterPosts = sortedPosts.filter((post) => post.data.tags.includes(tag));
return paginate(filterPosts, {
pageSize: 20,
pageSize: MAX_CATEGORIES,
params: { tag },
});
});