0
0
mirror of https://github.com/yude-jp/yude.jp synced 2024-12-22 20:20:09 +09:00

Add 404 page

This commit is contained in:
yude 2021-08-14 09:43:33 +09:00
parent 4b673b8c9c
commit 299034c391
Signed by: yude
GPG Key ID: EB0FE5D925C4A968
4 changed files with 39 additions and 1 deletions

View File

@ -9,6 +9,7 @@
"/house": ["house", "common"],
"/tos": ["tos", "common"],
"/hcunews": ["hcunews", "common"],
"/minecraft": ["minecraft", "common"]
"/minecraft": ["minecraft", "common"],
"/404": ["404", "common"]
}
}

4
locales/en/404.json Normal file
View File

@ -0,0 +1,4 @@
{
"caption": "The requested page does not exist on this website.",
"return": "Return to top"
}

4
locales/ja/404.json Normal file
View File

@ -0,0 +1,4 @@
{
"caption": "要求されたページはこのウェブサイト上に存在しません。",
"return": "トップページへ戻る"
}

29
pages/404.js Normal file
View File

@ -0,0 +1,29 @@
// Base layout
import Layout from "./components/Layout"
// React Router
import { useRouter } from 'next/router'
// Next.js
import Link from 'next/link'
import useTranslation from 'next-translate/useTranslation'
export default function Custom404(props) {
const router = useRouter()
const { locale, locales, defaultLocale, pathname } = router
const { t, lang } = useTranslation("404")
return (
<Layout title="404">
<div className="text-center mb-10 mt-10">
<p className="text-3xl">404</p>
<p className="text-xl">{t('caption')}</p>
<Link href="/">
<a>
<p className="mt-5">{t('return')}</p>
</a>
</Link>
</div>
</Layout>
)
}