aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/Form/Form.tsx4
-rw-r--r--src/components/Layouts/Layout.tsx26
-rw-r--r--src/components/PostPreview/PostPreview.tsx1
-rw-r--r--src/components/SearchForm/SearchForm.tsx2
4 files changed, 25 insertions, 8 deletions
diff --git a/src/components/Form/Form.tsx b/src/components/Form/Form.tsx
index 74a4efb..44763c4 100644
--- a/src/components/Form/Form.tsx
+++ b/src/components/Form/Form.tsx
@@ -5,16 +5,18 @@ const Form = ({
children,
submitHandler,
modifier = '',
+ id,
}: {
children: ReactNode;
submitHandler: any;
modifier?: string;
+ id?: string;
}) => {
const withModifier = modifier ? styles[`wrapper--${modifier}`] : '';
const classes = `${styles.wrapper} ${withModifier}`;
return (
- <form onSubmit={submitHandler} className={classes}>
+ <form onSubmit={submitHandler} className={classes} id={id}>
{children}
</form>
);
diff --git a/src/components/Layouts/Layout.tsx b/src/components/Layouts/Layout.tsx
index eb725d2..d529efe 100644
--- a/src/components/Layouts/Layout.tsx
+++ b/src/components/Layouts/Layout.tsx
@@ -7,7 +7,7 @@ import Head from 'next/head';
import { useRouter } from 'next/router';
import { ReactElement, ReactNode, useEffect, useRef } from 'react';
import { useIntl } from 'react-intl';
-import { WebSite, WithContext } from 'schema-dts';
+import { SearchAction, WebSite, WithContext } from 'schema-dts';
import styles from './Layout.module.scss';
const Layout = ({
@@ -40,11 +40,19 @@ const Layout = ({
creator: { '@id': `${settings.url}/#branding` },
editor: { '@id': `${settings.url}/#branding` },
inLanguage: settings.locales.defaultLocale,
- potentialAction: {
- '@type': 'SearchAction',
- target: `${settings.url}/recherche?s={query}`,
- query: 'required',
- },
+ potentialAction: { '@id': `${settings.url}/#search` },
+ };
+
+ type QueryAction = SearchAction & {
+ 'query-input': string;
+ };
+
+ const searchActionSchema: QueryAction = {
+ '@type': 'SearchAction',
+ '@id': `${settings.url}/#search`,
+ target: `${settings.url}/recherche?s={query}`,
+ query: 'required',
+ 'query-input': 'required name=query',
};
return (
@@ -94,6 +102,12 @@ const Layout = ({
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }}
></script>
+ <script
+ type="application/ld+json"
+ dangerouslySetInnerHTML={{
+ __html: JSON.stringify(searchActionSchema),
+ }}
+ ></script>
</Head>
<noscript>
<div className={styles['noscript-spacing']}></div>
diff --git a/src/components/PostPreview/PostPreview.tsx b/src/components/PostPreview/PostPreview.tsx
index 0be9709..3fbfa63 100644
--- a/src/components/PostPreview/PostPreview.tsx
+++ b/src/components/PostPreview/PostPreview.tsx
@@ -57,6 +57,7 @@ const PostPreview = ({
dateModified: updateDate.toISOString(),
datePublished: publicationDate.toISOString(),
editor: { '@id': `${settings.url}/#branding` },
+ headline: title,
image: featuredImage?.sourceUrl,
inLanguage: settings.locales.defaultLocale,
isBasedOn: `${settings.url}/article/${slug}`,
diff --git a/src/components/SearchForm/SearchForm.tsx b/src/components/SearchForm/SearchForm.tsx
index da6f25c..fa3ad07 100644
--- a/src/components/SearchForm/SearchForm.tsx
+++ b/src/components/SearchForm/SearchForm.tsx
@@ -34,7 +34,7 @@ const SearchForm = ({ isOpened }: { isOpened: boolean }) => {
description: 'SearchForm : form title',
})}
</div>
- <Form submitHandler={launchSearch} modifier="search">
+ <Form submitHandler={launchSearch} modifier="search" id="search">
<label htmlFor="search-query" className="screen-reader-text">
{intl.formatMessage({
defaultMessage: 'Keywords:',