From c2fb4401174388c47804788322b7b4fb2e4d8ee9 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Wed, 16 Feb 2022 16:19:09 +0100
Subject: 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.
---
 src/components/Layouts/Layout.tsx | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

(limited to 'src/components/Layouts/Layout.tsx')

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 (
-- 
cgit v1.2.3

