diff options
| author | Armand Philippot <git@armandphilippot.com> | 2021-12-18 12:31:26 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2021-12-18 12:31:26 +0100 |
| commit | a4058ef96e9bd87bfc9a2434bb0b3745696086eb (patch) | |
| tree | 92ff8098c64bd9ec831db776ed7e403533618d7e /src/pages/404.tsx | |
| parent | 50d37beeb51c95aaead8b3ef2c946189a066486e (diff) | |
chore: add a 404 page
Diffstat (limited to 'src/pages/404.tsx')
| -rw-r--r-- | src/pages/404.tsx | 52 |
1 files changed, 52 insertions, 0 deletions
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 ( + <> + <Head> + <title>{seo.error404.title}</title> + <meta name="description" content={seo.error404.description} /> + </Head> + <div> + <h1>{t`Page not found`}</h1> + <p> + <Trans> + Sorry, it seems that the page you are looking for does not exist. + </Trans>{' '} + <Trans> + If you think this path should work, feel free to{' '} + <Link href="/contact/">contact me</Link> with the necessary + information so that I can fix the problem. + </Trans> + </p> + </div> + </> + ); +}; + +error404.getLayout = (page: ReactElement) => <Layout>{page}</Layout>; + +export const getStaticProps: GetStaticProps = async ( + context: GetStaticPropsContext +) => { + const translation = await loadTranslation( + context.locale!, + process.env.NODE_ENV === 'production' + ); + + return { + props: { + translation, + }, + }; +}; + +export default error404; |
