Skip to content

Commit 7760835

Browse files
committed
refactor(docs): improve error handling and user experience for missing pages in documentation views
1 parent b9620b1 commit 7760835

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

docs/app/pages/[...slug].vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ const route = useRoute()
55
const { data: page } = await useAsyncData('page-' + route.path, () => {
66
return queryCollection('content').path(route.path).first()
77
})
8-
9-
if (!page.value) {
10-
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
11-
}
128
</script>
139

1410
<template>
1511
<div class=" overflow-y-auto ">
16-
<ContentRenderer
17-
v-if="page"
18-
:value="page"
19-
/>
12+
<template v-if="page">
13+
<ContentRenderer :value="page" />
14+
</template>
15+
<template v-else>
16+
<div class="empty-page">
17+
<h1>Page Not Found</h1>
18+
<p>Oops! The content you're looking for doesn't exist.</p>
19+
<NuxtLink to="/">Go back home</NuxtLink>
20+
</div>
21+
</template>
2022
</div>
2123
</template>

0 commit comments

Comments
 (0)