fix(tags): guard generateStaticParams against empty content dir

This commit is contained in:
kbot
2026-06-03 23:08:12 -05:00
parent 9ae127eb77
commit eaef10c824

View File

@@ -12,6 +12,9 @@ export const dynamic = 'force-static'
export async function generateStaticParams() {
const tags = await getAllTags()
if (tags.length === 0) {
return [{ tag: '__no-tags__' }]
}
return tags.map((tag) => ({ tag: tag.slug }))
}
@@ -27,6 +30,9 @@ export async function generateMetadata({ params }: TagPageProps): Promise<Metada
export default async function TagPage({ params }: TagPageProps) {
const slug = (await params).tag
if (slug === '__no-tags__') notFound()
const tags = await getAllTags()
const tag = tags.find((item) => item.slug === slug)