mirror of
https://github.com/supabase/supabase.git
synced 2026-10-18 07:39:07 +03:00
throw if slug is missing
This commit is contained in:
1 parent
7fc3cbd23d
commit
c6f426402d
1 file changed
+5
-1
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user