From a4058ef96e9bd87bfc9a2434bb0b3745696086eb Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Sat, 18 Dec 2021 12:31:26 +0100 Subject: chore: add a 404 page --- src/config/seo.ts | 4 ++++ src/pages/404.tsx | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/pages/404.tsx (limited to 'src') diff --git a/src/config/seo.ts b/src/config/seo.ts index f2a22a6..89e38c2 100644 --- a/src/config/seo.ts +++ b/src/config/seo.ts @@ -21,4 +21,8 @@ export const seo = { title: t`Legal notice | Armand Philippot`, description: t`Discover the ArmandPhilippot.com website legal notice.`, }, + error404: { + title: t`Error 404: Page not found | Armand Philippot`, + description: '', + }, }; diff --git a/src/pages/404.tsx b/src/pages/404.tsx new file mode 100644 index 0000000..903a386 --- /dev/null +++ b/src/pages/404.tsx @@ -0,0 +1,52 @@ +import Layout from '@components/Layouts/Layout'; +import { seo } from '@config/seo'; +import { t, Trans } from '@lingui/macro'; +import { NextPageWithLayout } from '@ts/types/app'; +import { loadTranslation } from '@utils/helpers/i18n'; +import { GetStaticProps, GetStaticPropsContext } from 'next'; +import Head from 'next/head'; +import Link from 'next/link'; +import { ReactElement } from 'react'; + +const error404: NextPageWithLayout = () => { + return ( + <> + + {seo.error404.title} + + +
+

{t`Page not found`}

+

+ + Sorry, it seems that the page you are looking for does not exist. + {' '} + + If you think this path should work, feel free to{' '} + contact me with the necessary + information so that I can fix the problem. + +

+
+ + ); +}; + +error404.getLayout = (page: ReactElement) => {page}; + +export const getStaticProps: GetStaticProps = async ( + context: GetStaticPropsContext +) => { + const translation = await loadTranslation( + context.locale!, + process.env.NODE_ENV === 'production' + ); + + return { + props: { + translation, + }, + }; +}; + +export default error404; -- cgit v1.2.3