diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-16 12:46:38 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-05-16 12:46:38 +0200 |
| commit | 2155550fa36a3bc3c8f66e0926530123b4018cd4 (patch) | |
| tree | 1b7472d7ceeb9c95b2c6de6440b48b94405e155e /src/pages/recherche/index.tsx | |
| parent | 8a55aa83bd4b64d1d989cb49b7d9c3fdc1cc6ea5 (diff) | |
refactor: use custom hook for breadcrumb items and schema
Diffstat (limited to 'src/pages/recherche/index.tsx')
| -rw-r--r-- | src/pages/recherche/index.tsx | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/pages/recherche/index.tsx b/src/pages/recherche/index.tsx index bf14861..0a7dc60 100644 --- a/src/pages/recherche/index.tsx +++ b/src/pages/recherche/index.tsx @@ -1,6 +1,5 @@ import Notice from '@components/atoms/layout/notice'; import Spinner from '@components/atoms/loaders/spinner'; -import { type BreadcrumbItem } from '@components/molecules/nav/breadcrumb'; import PostsList, { type Post } from '@components/organisms/layout/posts-list'; import LinksListWidget from '@components/organisms/widgets/links-list-widget'; import PageLayout from '@components/templates/page/page-layout'; @@ -26,6 +25,7 @@ import { getLinksListItems, getPageLinkFromRawData, } from '@utils/helpers/pages'; +import useBreadcrumb from '@utils/hooks/use-breadcrumb'; import useDataFromAPI from '@utils/hooks/use-data-from-api'; import usePagination from '@utils/hooks/use-pagination'; import useSettings from '@utils/hooks/use-settings'; @@ -65,21 +65,10 @@ const SearchPage: NextPage<SearchPageProps> = ({ description: 'SearchPage: SEO - Page title', id: 'WDwNDl', }); - const homeLabel = intl.formatMessage({ - defaultMessage: 'Home', - description: 'Breadcrumb: home label', - id: 'j5k9Fe', + const { items: breadcrumbItems, schema: breadcrumbSchema } = useBreadcrumb({ + title, + url: `/recherche`, }); - const blogLabel = intl.formatMessage({ - defaultMessage: 'Blog', - description: 'Breadcrumb: blog label', - id: 'Es52wh', - }); - const breadcrumb: BreadcrumbItem[] = [ - { id: 'home', name: homeLabel, url: '/' }, - { id: 'blog', name: blogLabel, url: '/blog' }, - { id: 'search', name: title, url: '/recherche' }, - ]; const { blog, website } = useSettings(); const pageTitle = `${title} - ${website.name}`; @@ -253,7 +242,8 @@ const SearchPage: NextPage<SearchPageProps> = ({ /> <PageLayout title={title} - breadcrumb={breadcrumb} + breadcrumb={breadcrumbItems} + breadcrumbSchema={breadcrumbSchema} headerMeta={{ total: postsCount }} widgets={[ <LinksListWidget |
