From 85c4c42bd601270d7be0f34a0767a34bb85e29bb Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Tue, 12 Dec 2023 18:50:03 +0100 Subject: refactor(hooks): rewrite useBreadcrumbs hook * use next/router to get the slug instead of using props * handle cases where the current page title is not provided * update JSON-LD schema to match the example in documentation * add tests --- src/pages/404.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/pages/404.tsx') diff --git a/src/pages/404.tsx b/src/pages/404.tsx index 6ef0c55..450859c 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -36,7 +36,11 @@ import { CONFIG } from '../utils/config'; import { ROUTES } from '../utils/constants'; import { getLinksItemData } from '../utils/helpers'; import { loadTranslation, type Messages } from '../utils/helpers/server'; -import { useBreadcrumb, useThematicsList, useTopicsList } from '../utils/hooks'; +import { + useBreadcrumbs, + useThematicsList, + useTopicsList, +} from '../utils/hooks'; const link = (chunks: ReactNode) => {chunks}; @@ -110,10 +114,9 @@ const Error404Page: NextPageWithLayout = ({ data }) => { }), }, }; - const { items: breadcrumbItems, schema: breadcrumbSchema } = useBreadcrumb({ - title: messages.page.title, - url: ROUTES.NOT_FOUND, - }); + const { items: breadcrumbItems, schema: breadcrumbSchema } = useBreadcrumbs( + messages.page.title + ); const searchSubmitHandler: SearchFormSubmit = useCallback( async ({ query }) => { -- cgit v1.2.3