Skip to content

Commit 24934da

Browse files
make 404 into its own component and use on blog
1 parent dd4f613 commit 24934da

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed

app/components/NotFound.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<template>
2+
<div class="text-center flex flex-col items-center justify-center self-center">
3+
<h1 class="text-9xl">404</h1>
4+
<h1 class="text-4xl">That page does not exist!</h1>
5+
<NuxtLink to="https://twitter.com/sawaratsuki1004">
6+
<NuxtImg src="/images/NotFound.webp" width="600" />
7+
</NuxtLink>
8+
<a href="https://twitter.com/sawaratsuki1004" class="mr-auto pl-[5%] text-sm mt-[-10%] mb-[10%]">Illustration by @sawaratsuki1004</a>
9+
<div class="flex gap-6">
10+
<UButton class="text-2xl bg-primary-600 hover:bg-secondary-700 cursor-pointer">
11+
<NuxtLink class="bg-transparent text-black no-underline" to="/">Go to home</NuxtLink>
12+
</UButton>
13+
<UButton class="text-2xl bg-primary-600 hover:bg-secondary-700 cursor-pointer">
14+
<NuxtLink class="bg-transparent text-black no-underline" to="/">Check out all blog articles</NuxtLink>
15+
</UButton>
16+
</div>
17+
</div>
18+
</template>

app/error.vue

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,9 @@
1010

1111
<template>
1212
<div class="min-h-screen flex items-center justify-center">
13-
<div class="text-center">
14-
<div v-if="error?.statusCode == 404" class="min-h-screen flex flex-col items-center justify-center">
15-
<h1 class="text-9xl">404</h1>
16-
<h1 class="text-4xl">That page does not exist!</h1>
17-
<a href="https://twitter.com/sawaratsuki1004">
18-
<NuxtImg src="/images/NotFound.webp" width="600" />
19-
</a>
20-
<a href="https://twitter.com/sawaratsuki1004" class="block mr-auto pl-9 text-sm mt-[-10%] mb-14">Illustration by @sawaratsuki1004</a>
21-
<UButton class="text-2xl bg-primary-600 hover:bg-secondary-700 cursor-pointer">
22-
<NuxtLink class="bg-transparent text-black no-underline" to="/">Go back home</NuxtLink>
23-
</UButton>
13+
<div>
14+
<div v-if="error?.statusCode == 404">
15+
<NotFound />
2416
</div>
2517
<div v-else>
2618
<h1 class="text-9xl">{{ error?.statusCode }}</h1>

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@
33
<article>
44
<Suspense>
55
<template #default>
6-
<main>
6+
<main v-if="page">
77
<div class="min-h-[1.65rem] mb-[-30px]">
88
<LazyPostMeta v-if="isMounted" />
99
</div>
1010

1111
<ContentRenderer v-if="page" :value="page" />
12-
<div class="text-center py-16" v-else>
13-
<h1 class="text-4xl font-bold mb-4">Page Not Found (404)</h1>
14-
<p class="text-lg mb-4">Sorry, the page you are looking for does not exist.</p>
15-
<NuxtLink to="/blog" class="text-primary underline">View all blog articles</NuxtLink><br />
16-
<NuxtLink to="/" class="text-primary underline">Go back to the homepage</NuxtLink>
17-
</div>
1812
<hr />
1913
<RelatedPosts v-if="isMounted" />
2014
</main>
15+
<div v-else class="min-h-screen flex items-center justify-center">
16+
<div class="w-1/3">
17+
<NotFound />
18+
</div>
19+
</div>
2120
</template>
2221
<template #fallback>
2322
<div class="animate-pulse">

0 commit comments

Comments
 (0)