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

feat: add 404 page #114

Merged
merged 2 commits into from
Aug 5, 2024
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
6 changes: 6 additions & 0 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/HomeView.vue";
import ArticleView from "../views/ArticleView.vue";
import CollectionView from "../views/CollectionView.vue";
import NotFoundView from "../views/NotFoundView.vue";
import { useHead } from 'unhead'


Expand All @@ -23,6 +24,11 @@ const router = createRouter({
name: "article",
component: ArticleView,
},
{
path: "/:pathMatch(.*)*",
name: "notfound",
component: NotFoundView,
}
],
});

Expand Down
13 changes: 13 additions & 0 deletions src/views/NotFoundView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<section class="bg-gray-100 dark:bg-gray-800 text-black dark:text-gray-200">
<div class="container mx-auto py-20 px-4 text-center print:text-black">
<h1 class="text-6xl font-extrabold animate-pulse">404</h1>
<h2 class="text-2xl font-bold">Not Found</h2>
<p class="mt-4">The page you are looking for does not exist.</p>
</div>
</section>
<section class="text-center mt-10 flex gap-6 flex-col lg:w-[55%] mx-auto sm:w-full items-center justify-center">
<img src="https://i.imgflip.com/6pvb0b.png" alt="404" class="rounded-xl w-[85%]">
<a href="/" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded mt-6 sm:w-[50%] md:w-[30%] lg:w-[20%]">Go Home</a>
</section>
</template>