diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-19 13:56:34 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-19 14:22:28 +0100 |
| commit | a26b775b7bbf1abd3e99c8bf9ce4c7522d3a0adc (patch) | |
| tree | 7f041845fa64d00f20f949d1cba14fec3eca3435 /src/pages/index.tsx | |
| parent | 813084fc23113ae2f594bf6ef1cf53bd003c9479 (diff) | |
chore: add structured data using schema.org and JSON-LD
I also added the featured image on single article.
Diffstat (limited to 'src/pages/index.tsx')
| -rw-r--r-- | src/pages/index.tsx | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 3664ae1..f59602f 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -11,6 +11,8 @@ import styles from '@styles/pages/Home.module.scss'; import { t } from '@lingui/macro'; import FeedIcon from '@assets/images/icon-feed.svg'; import { ContactIcon } from '@components/Icons'; +import { Graph, WebPage } from 'schema-dts'; +import { config } from '@config/website'; const Home: NextPageWithLayout = () => { const CodingLinks = () => { @@ -90,13 +92,39 @@ const Home: NextPageWithLayout = () => { MoreLinks: MoreLinks, }; + const webpageSchema: WebPage = { + '@id': `${config.url}/#home`, + '@type': 'WebPage', + breadcrumb: { '@id': `${config.url}/#breadcrumb` }, + name: seo.legalNotice.title, + description: seo.legalNotice.description, + author: { '@id': `${config.url}/#branding` }, + creator: { '@id': `${config.url}/#branding` }, + editor: { '@id': `${config.url}/#branding` }, + inLanguage: config.defaultLocale, + license: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fr', + reviewedBy: { '@id': `${config.url}/#branding` }, + url: `${config.url}`, + }; + + const schemaJsonLd: Graph = { + '@context': 'https://schema.org', + '@graph': [webpageSchema], + }; + return ( <> <Head> <title>{seo.homepage.title}</title> <meta name="description" content={seo.homepage.description} /> + <script + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + ></script> </Head> - <HomePageContent components={components} /> + <div id="home"> + <HomePageContent components={components} /> + </div> </> ); }; |
