Skip to content

Commit

Permalink
Merge pull request timlrx#1096 from Onissom/patch-1
Browse files Browse the repository at this point in the history
Tag Page Generation Patch
  • Loading branch information
timlrx authored Jan 20, 2025
2 parents d4f2504 + 2cd6669 commit 9a20462
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/tags/[tag]/page/[page]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export const generateStaticParams = async () => {
const tagCounts = tagData as Record<string, number>
return Object.keys(tagCounts).flatMap((tag) => {
const postCount = tagCounts[tag]
const totalPages = Math.ceil(postCount / POSTS_PER_PAGE)
return Array.from({ length: totalPages - 1 }, (_, i) => ({
const totalPages = Math.max(1, Math.ceil(postCount / POSTS_PER_PAGE))
return Array.from({ length: totalPages }, (_, i) => ({
tag: encodeURI(tag),
page: (i + 2).toString(),
page: (i + 1).toString(),
}))
})
}
Expand Down

0 comments on commit 9a20462

Please sign in to comment.