feat: update pagesize

This commit is contained in:
KazooTTT
2024-10-11 13:05:50 +08:00
parent d825b447fa
commit acf74dac51
4 changed files with 8 additions and 3 deletions

View File

@ -10,6 +10,11 @@
"astro": "astro", "astro": "astro",
"lint": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx,svelte,astro}\" && eslint --fix \"src/**/*.{js,ts,jsx,tsx,svelte,astro}\"" "lint": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx,svelte,astro}\" && eslint --fix \"src/**/*.{js,ts,jsx,tsx,svelte,astro}\""
}, },
"husky": {
"hooks": {
"pre-commit": "npm run lint"
}
},
"dependencies": { "dependencies": {
"@astrojs/check": "^0.5.6", "@astrojs/check": "^0.5.6",
"@astrojs/mdx": "^2.1.1", "@astrojs/mdx": "^2.1.1",

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: 20, props: { uniqueTags, uniqueCategories } }) return paginate(allPostsByDate, { pageSize: 50, props: { uniqueTags, uniqueCategories } })
}) satisfies GetStaticPaths }) satisfies GetStaticPaths
interface Props { interface Props {

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: 20, pageSize: 50,
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: 20, pageSize: 50,
params: { tag } params: { tag }
}) })
}) })