Skip to content

Commit

Permalink
fix: throw 404 error when content not found (#611)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Aug 1, 2022
1 parent 38948c0 commit 9755a1e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pages/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ definePageMeta({
const { page } = useContent()
const theme = useTheme()
// Page not found
if (!page.value) {
throwError(
createError({
statusCode: 404,
statusMessage: `Page not found: ${useRoute().path}`,
}),
)
}
const cover = computed(() => {
const cover = page.value?.cover || theme.value?.cover
if (typeof cover === 'string') {
Expand Down

0 comments on commit 9755a1e

Please sign in to comment.