summaryrefslogtreecommitdiffstats
path: root/src/pages/recherche/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/recherche/index.tsx')
-rw-r--r--src/pages/recherche/index.tsx49
1 files changed, 17 insertions, 32 deletions
diff --git a/src/pages/recherche/index.tsx b/src/pages/recherche/index.tsx
index c69d931..ab619fb 100644
--- a/src/pages/recherche/index.tsx
+++ b/src/pages/recherche/index.tsx
@@ -22,6 +22,11 @@ import {
getPageLinkFromRawData,
getPostsList,
} from '@utils/helpers/pages';
+import {
+ getBlogSchema,
+ getSchemaJson,
+ getWebPageSchema,
+} from '@utils/helpers/schema-org';
import useBreadcrumb from '@utils/hooks/use-breadcrumb';
import useDataFromAPI from '@utils/hooks/use-data-from-api';
import usePagination from '@utils/hooks/use-pagination';
@@ -31,7 +36,6 @@ import Head from 'next/head';
import { useRouter } from 'next/router';
import Script from 'next/script';
import { useIntl } from 'react-intl';
-import { Blog, Graph, WebPage } from 'schema-dts';
type SearchPageProps = {
thematicsList: RawThematicPreview[];
@@ -87,37 +91,18 @@ const SearchPage: NextPageWithLayout<SearchPageProps> = ({
},
{ websiteName: website.name }
);
- const pageUrl = `${website.url}${asPath}`;
-
- const webpageSchema: WebPage = {
- '@id': `${pageUrl}`,
- '@type': 'WebPage',
- breadcrumb: { '@id': `${website.url}/#breadcrumb` },
- name: pageTitle,
+ const webpageSchema = getWebPageSchema({
description: pageDescription,
- inLanguage: website.locales.default,
- reviewedBy: { '@id': `${website.url}/#branding` },
- url: `${website.url}`,
- isPartOf: {
- '@id': `${website.url}`,
- },
- };
-
- const blogSchema: Blog = {
- '@id': `${website.url}/#blog`,
- '@type': 'Blog',
- author: { '@id': `${website.url}/#branding` },
- creator: { '@id': `${website.url}/#branding` },
- editor: { '@id': `${website.url}/#branding` },
- inLanguage: website.locales.default,
- license: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fr',
- mainEntityOfPage: { '@id': `${pageUrl}` },
- };
-
- const schemaJsonLd: Graph = {
- '@context': 'https://schema.org',
- '@graph': [webpageSchema, blogSchema],
- };
+ locale: website.locales.default,
+ slug: asPath,
+ title: pageTitle,
+ });
+ const blogSchema = getBlogSchema({
+ isSinglePage: false,
+ locale: website.locales.default,
+ slug: asPath,
+ });
+ const schemaJsonLd = getSchemaJson([webpageSchema, blogSchema]);
const {
data,
@@ -161,7 +146,7 @@ const SearchPage: NextPageWithLayout<SearchPageProps> = ({
<Head>
<title>{pageTitle}</title>
<meta name="description" content={pageDescription} />
- <meta property="og:url" content={`${pageUrl}`} />
+ <meta property="og:url" content={`${website.url}${asPath}`} />
<meta property="og:type" content="website" />
<meta property="og:title" content={title} />
<meta property="og:description" content={pageDescription} />