Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

throw if slug is missing

Daniel Cruzc6f426402d36
diff --git a/apps/www/pages/blog/[slug].tsx b/apps/www/pages/blog/[slug].tsx
index cb8e50b674b..8d14d639404 100644
--- a/apps/www/pages/blog/[slug].tsx
+++ b/apps/www/pages/blog/[slug].tsx
@@ -73,7 +73,11 @@ export async function getStaticPaths() {
}
export const getStaticProps: GetStaticProps<BlogPostPageProps, Params> = async ({ params }) => {
- const filePath = `${params?.slug}`
+ if (params?.slug === undefined) {
+ throw new Error('Missing slug for pages/blog/[slug].tsx')
+ }
+
+ const filePath = `${params.slug}`
const postContent = await getPostdata(filePath, '_blog')
const { data, content } = matter(postContent) as unknown as MatterReturn