diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-12-12 18:50:03 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-12-12 18:50:03 +0100 |
| commit | 85c4c42bd601270d7be0f34a0767a34bb85e29bb (patch) | |
| tree | 16a07a89cf209139672592fd6988f0c028acb7e9 /src/pages/404.tsx | |
| parent | 93f87c10783e3d76f1dec667779aedffcae33a39 (diff) | |
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
Diffstat (limited to 'src/pages/404.tsx')
| -rw-r--r-- | src/pages/404.tsx | 13 |
1 files changed, 8 insertions, 5 deletions
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) => <Link href={ROUTES.CONTACT}>{chunks}</Link>; @@ -110,10 +114,9 @@ const Error404Page: NextPageWithLayout<Error404PageProps> = ({ 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 }) => { |
