Skip to content

Commit

Permalink
feat: added 404 page
Browse files Browse the repository at this point in the history
  • Loading branch information
onmax committed Mar 22, 2024
1 parent 46e97e2 commit 544f176
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
21 changes: 20 additions & 1 deletion .vitepress/theme/MainLayout.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
<script setup lang="ts">
import DefaultTheme from 'vitepress/theme'
import RegisterSw from './components/RegisterSW.vue'
const baseUrl = import.meta.env.BASE_URL
</script>

<template>
<RegisterSW />
<DefaultTheme.Layout bg-neutral-0 class="vp-raw" />
<DefaultTheme.Layout bg-neutral-0 class="vp-raw">
<template #not-found>
<main px-32 mt="48 md:96" max-w-70ch mx-auto>
<h1 text-20>
<span font-bold>404</span> Page not found
</h1>

<div class="prose" mt-24>
<blockquote px-0>
<p font-italic>
But if you keep looking, you'll find it.
</p>
</blockquote>
<a :href="baseUrl" pill-blue arrow text-white mt-24 ml-0>Go home</a>
</div>
</main>
</template>
</DefaultTheme.Layout>
</template>

<style>
Expand Down
2 changes: 1 addition & 1 deletion .vitepress/theme/components/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { hasSidebar } = useSidebar()
const hasOutline = computed(() => page.value.frontmatter.outline !== false)
const isHome = computed(() => page.value.frontmatter.layout === 'home')
const isHome = computed(() => page.value.frontmatter.layout === 'home' || page.value.title === '404')
const isMd = computed(() => hasSidebar.value && !hasOutline.value)
</script>

Expand Down
2 changes: 1 addition & 1 deletion dev-dist/sw.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 544f176

Please sign in to comment.