From a26b775b7bbf1abd3e99c8bf9ce4c7522d3a0adc Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 19 Jan 2022 13:56:34 +0100 Subject: chore: add structured data using schema.org and JSON-LD I also added the featured image on single article. --- src/components/Layouts/Layout.tsx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/components/Layouts/Layout.tsx') diff --git a/src/components/Layouts/Layout.tsx b/src/components/Layouts/Layout.tsx index f5116f8..2e7d255 100644 --- a/src/components/Layouts/Layout.tsx +++ b/src/components/Layouts/Layout.tsx @@ -7,6 +7,7 @@ import { t } from '@lingui/macro'; import Head from 'next/head'; import { config } from '@config/website'; import { useRouter } from 'next/router'; +import { WebSite, WithContext } from 'schema-dts'; const Layout = ({ children, @@ -22,6 +23,25 @@ const Layout = ({ ref.current?.focus(); }, [asPath]); + const schemaJsonLd: WithContext = { + '@context': 'https://schema.org', + '@id': `${config.url}`, + '@type': 'WebSite', + name: config.name, + description: config.baseline, + url: config.url, + author: { '@id': `${config.url}/#branding` }, + copyrightYear: Number(config.copyright.startYear), + creator: { '@id': `${config.url}/#branding` }, + editor: { '@id': `${config.url}/#branding` }, + inLanguage: config.defaultLocale, + potentialAction: { + '@type': 'SearchAction', + target: `${config.url}/recherche?s={query}`, + query: 'required', + }, + }; + return ( <> @@ -43,6 +63,10 @@ const Layout = ({ type="application/feed+json" title={`${config.name}'s RSS feed`} /> + {t`Skip to content`} -- cgit v1.2.3