aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/404.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-05-16 12:46:38 +0200
committerArmand Philippot <git@armandphilippot.com>2022-05-16 12:46:38 +0200
commit2155550fa36a3bc3c8f66e0926530123b4018cd4 (patch)
tree1b7472d7ceeb9c95b2c6de6440b48b94405e155e /src/pages/404.tsx
parent8a55aa83bd4b64d1d989cb49b7d9c3fdc1cc6ea5 (diff)
refactor: use custom hook for breadcrumb items and schema
Diffstat (limited to 'src/pages/404.tsx')
-rw-r--r--src/pages/404.tsx16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/pages/404.tsx b/src/pages/404.tsx
index 7459c80..4f6e22d 100644
--- a/src/pages/404.tsx
+++ b/src/pages/404.tsx
@@ -1,5 +1,4 @@
import Link from '@components/atoms/links/link';
-import { type BreadcrumbItem } from '@components/molecules/nav/breadcrumb';
import LinksListWidget from '@components/organisms/widgets/links-list-widget';
import PageLayout from '@components/templates/page/page-layout';
import {
@@ -16,6 +15,7 @@ import {
getLinksListItems,
getPageLinkFromRawData,
} from '@utils/helpers/pages';
+import useBreadcrumb from '@utils/hooks/use-breadcrumb';
import useSettings from '@utils/hooks/use-settings';
import { GetStaticProps, NextPage } from 'next';
import Head from 'next/head';
@@ -53,15 +53,10 @@ const Error404Page: NextPage<Error404PageProps> = ({
link: (chunks: ReactNode) => <Link href="/contact">{chunks}</Link>,
}
);
- const homeLabel = intl.formatMessage({
- defaultMessage: 'Home',
- description: 'Breadcrumb: home label',
- id: 'j5k9Fe',
+ const { items: breadcrumbItems, schema: breadcrumbSchema } = useBreadcrumb({
+ title,
+ url: `/404`,
});
- const breadcrumb: BreadcrumbItem[] = [
- { id: 'home', name: homeLabel, url: '/' },
- { id: 'error-404', name: title, url: '/404' },
- ];
const pageTitle = intl.formatMessage(
{
defaultMessage: 'Error 404: Page not found - {websiteName}',
@@ -95,7 +90,8 @@ const Error404Page: NextPage<Error404PageProps> = ({
</Head>
<PageLayout
title={title}
- breadcrumb={breadcrumb}
+ breadcrumb={breadcrumbItems}
+ breadcrumbSchema={breadcrumbSchema}
widgets={[
<LinksListWidget
key="thematics-list"