File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
app/tags/[tag]/page/[page] Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,17 @@ const POSTS_PER_PAGE = 5
99
1010export async function generateStaticParams ( ) {
1111 const blogs = allBlogs . map ( ( post ) => post . tags || [ ] ) . flat ( )
12- const allTags = [ ...new Set ( [ ... blogs ] ) ]
12+ const allTags = [ ...new Set ( blogs ) ]
1313
14- return allTags . map ( ( tag ) => ( {
15- tag : tag ,
16- } ) )
14+ const params : { tag : string ; page : string } [ ] = [ ] // Add explicit type
15+ for ( const tag of allTags ) {
16+ const tagPosts = allBlogs . filter ( ( post ) => post . tags ?. includes ( tag ) )
17+ const totalPages = Math . ceil ( tagPosts . length / POSTS_PER_PAGE )
18+ for ( let page = 1 ; page <= totalPages ; page ++ ) {
19+ params . push ( { tag, page : page . toString ( ) } )
20+ }
21+ }
22+ return params
1723}
1824export default async function TagPage ( props : { params : Promise < { tag : string ; page : string } > } ) {
1925 const params = await props . params
Original file line number Diff line number Diff line change @@ -4605,9 +4605,9 @@ __metadata:
46054605 linkType : hard
46064606
46074607" caniuse-lite@npm:^1.0.30001579, caniuse-lite@npm:^1.0.30001646, caniuse-lite@npm:^1.0.30001688 " :
4608- version : 1.0.30001699
4609- resolution : " caniuse-lite@npm:1.0.30001699 "
4610- checksum : 697172065537b0f33c428fe8561f4cba6796428dc8e3e56f78eee28404edfcbea70d48bb109ab6c6536de6da90e331058a2cb8ef3a15c58b2226c96ee558bc07
4608+ version : 1.0.30001761
4609+ resolution : " caniuse-lite@npm:1.0.30001761 "
4610+ checksum : e1b6ed282fef24cbfccb944a4f1154804148ba59aa83bae2b5b652f375f4c6205579fadf530a23e93c2c901a736bbff6d8eebeabdf14c09c28125cda31d9a548
46114611 languageName : node
46124612 linkType : hard
46134613
You can’t perform that action at this time.
0 commit comments