From a1fc14d838af5fa40eb6bfa06f42ade438898a2d Mon Sep 17 00:00:00 2001 From: KazooTTT Date: Tue, 15 Apr 2025 16:46:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E4=BB=A5=E5=8C=B9=E9=85=8D=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/categories/[category]/[...page].astro | 3 ++- src/pages/tags/[tag]/[...page].astro | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/categories/[category]/[...page].astro b/src/pages/categories/[category]/[...page].astro index a44f65e..54ba732 100644 --- a/src/pages/categories/[category]/[...page].astro +++ b/src/pages/categories/[category]/[...page].astro @@ -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 }, }); }); diff --git a/src/pages/tags/[tag]/[...page].astro b/src/pages/tags/[tag]/[...page].astro index 8006b60..0050f3b 100644 --- a/src/pages/tags/[tag]/[...page].astro +++ b/src/pages/tags/[tag]/[...page].astro @@ -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 }, }); });