Skip to content

Commit fbd948a

Browse files
committed
add generateStaticParams()
1 parent 1b505e7 commit fbd948a

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

app/tags/[tag]/page.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ export async function generateMetadata(props: {
2626
})
2727
}
2828

29-
export const generateStaticParams = async () => {
30-
const tagCounts = tagData as Record<string, number>
31-
const tagKeys = Object.keys(tagCounts)
32-
return tagKeys.map((tag) => ({
33-
tag: encodeURI(tag),
29+
export async function generateStaticParams() {
30+
const blogs = allBlogs.map((post) => post.tags || []).flat()
31+
const allTags = [...new Set([...blogs])]
32+
33+
return allTags.map((tag) => ({
34+
tag: tag,
3435
}))
3536
}
3637

38+
3739
export default async function TagPage(props: { params: Promise<{ tag: string }> }) {
3840
const params = await props.params
3941
const tag = decodeURI(params.tag)

0 commit comments

Comments
 (0)