return 404 for invalid page

This commit is contained in:
Dom Sip 2022-03-24 11:02:19 +00:00
parent 64677c2fe9
commit ef5298664c

View File

@ -38,8 +38,9 @@ export async function getStaticProps({
const page = data?.page const page = data?.page
if (!page) { if (!page) {
// We throw to make sure this fails at build time as this is never expected to happen return {
throw new Error(`Page with slug '${slug}' not found`) notFound: true,
}
} }
return { return {