Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error page done #452

Merged
merged 2 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions nuxtjs.org/components/templates/Error.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<template>
<AppPage class="min-h-screen-sm">
<div class="mt-48 flex items-center justify-center flex-col px-4 md:px-0">
<h1 class="font-serif text-display-6 md:text-display-5 2xl:text-display-4 text-center">{{ error.message }}</h1>
<p class="text-center mt-4 mb-4">We couldn't find the page you are looking for.</p>
<SectionButton to="/" size="md" class="bg-primary text-gray-800 hover:bg-green-300 focus:bg-green-300">
Go back home
</SectionButton>
</div>
</AppPage>
</template>

<script>
import { defineComponent } from '@nuxtjs/composition-api'

export default defineComponent({
props: {
error: {
type: Object,
required: true
}
},
head() {
return {
title: this.error.message
}
},
templateOptions: {
aside: false,
fluid: false
}
})
</script>
2 changes: 1 addition & 1 deletion src/app/pages/_.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default defineComponent({
const [page] = await $docus.search({ deep: true }).where({ language, to, draft }).fetch()

// Break on missing page query
if (!page) return error({ statusCode: 404, message: 'Page not found' })
if (!page) return error({ statusCode: 404, message: '404 - Page not found' })

// Get page template
page.template = $docus.getPageTemplate(page)
Expand Down