Skip to content

Commit 9a20462

Browse files
authored
Merge pull request #1096 from Onissom/patch-1
Tag Page Generation Patch
2 parents d4f2504 + 2cd6669 commit 9a20462

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/tags/[tag]/page/[page]/page.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ export const generateStaticParams = async () => {
1111
const tagCounts = tagData as Record<string, number>
1212
return Object.keys(tagCounts).flatMap((tag) => {
1313
const postCount = tagCounts[tag]
14-
const totalPages = Math.ceil(postCount / POSTS_PER_PAGE)
15-
return Array.from({ length: totalPages - 1 }, (_, i) => ({
14+
const totalPages = Math.max(1, Math.ceil(postCount / POSTS_PER_PAGE))
15+
return Array.from({ length: totalPages }, (_, i) => ({
1616
tag: encodeURI(tag),
17-
page: (i + 2).toString(),
17+
page: (i + 1).toString(),
1818
}))
1919
})
2020
}

0 commit comments

Comments
 (0)