diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-02-16 16:19:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-16 16:19:09 +0100 |
| commit | c2fb4401174388c47804788322b7b4fb2e4d8ee9 (patch) | |
| tree | 9ba813b65026d42a3483af900186f4ad65bfea80 /src/components | |
| parent | 0c76e4165bcdf688fabc52d585c6cec5ac568b90 (diff) | |
chore: remove the use of id reference for potentialAction (#6)
Google doesn't like the id reference here. So, instead, I include the
variable directly.
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Layouts/Layout.tsx | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/components/Layouts/Layout.tsx b/src/components/Layouts/Layout.tsx index d529efe..9a47b2b 100644 --- a/src/components/Layouts/Layout.tsx +++ b/src/components/Layouts/Layout.tsx @@ -26,6 +26,20 @@ const Layout = ({ ref.current?.focus(); }, [asPath]); + type QueryAction = SearchAction & { + 'query-input': string; + }; + + const searchActionSchema: QueryAction = { + '@type': 'SearchAction', + target: { + '@type': 'EntryPoint', + urlTemplate: `${settings.url}/recherche?s={search_term_string}`, + }, + query: 'required', + 'query-input': 'required name=search_term_string', + }; + const schemaJsonLd: WithContext<WebSite> = { '@context': 'https://schema.org', '@id': `${settings.url}`, @@ -40,19 +54,7 @@ const Layout = ({ creator: { '@id': `${settings.url}/#branding` }, editor: { '@id': `${settings.url}/#branding` }, inLanguage: settings.locales.defaultLocale, - 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', + potentialAction: searchActionSchema, }; return ( |
