From a16d23dcde76874fab4b6bdb45067fd01b88cdc1 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 19 Jan 2022 15:50:23 +0100 Subject: chore: add opengraph and twitter meta --- src/components/Layouts/Layout.tsx | 8 ++++++++ src/config/website.ts | 1 + src/pages/article/[slug].tsx | 17 ++++++++++++----- src/pages/blog/index.tsx | 13 ++++++++++--- src/pages/contact.tsx | 11 ++++++++--- src/pages/cv.tsx | 13 ++++++++++--- src/pages/index.tsx | 4 ++++ src/pages/mentions-legales.tsx | 11 ++++++++--- src/pages/sujet/[slug].tsx | 14 ++++++++++++-- src/pages/thematique/[slug].tsx | 9 +++++++-- 10 files changed, 80 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/components/Layouts/Layout.tsx b/src/components/Layouts/Layout.tsx index 1ca954a..0a3aa3d 100644 --- a/src/components/Layouts/Layout.tsx +++ b/src/components/Layouts/Layout.tsx @@ -45,6 +45,14 @@ const Layout = ({ return ( <> + + + + + = ({ post }) => { const router = useRouter(); const locale = router.locale ? router.locale : config.locales.defaultLocale; + const articleUrl = `${config.url}${router.asPath}`; useEffect(() => { addPrismClasses(); @@ -55,14 +56,14 @@ const SingleArticle: NextPageWithLayout = ({ post }) => { }, [locale]); const webpageSchema: WebPage = { - '@id': `${config.url}${router.asPath}`, + '@id': `${articleUrl}`, '@type': 'WebPage', breadcrumb: { '@id': `${config.url}/#breadcrumb` }, lastReviewed: dates.update, name: seo.title, description: seo.metaDesc, reviewedBy: { '@id': `${config.url}/#branding` }, - url: `${config.url}${router.asPath}`, + url: `${articleUrl}`, isPartOf: { '@id': `${config.url}`, }, @@ -73,7 +74,7 @@ const SingleArticle: NextPageWithLayout = ({ post }) => { '@type': 'Blog', blogPost: { '@id': `${config.url}/#article` }, isPartOf: { - '@id': `${config.url}${router.asPath}`, + '@id': `${articleUrl}`, }, license: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fr', }; @@ -94,7 +95,7 @@ const SingleArticle: NextPageWithLayout = ({ post }) => { dateCreated: publicationDate.toISOString(), dateModified: updateDate.toISOString(), datePublished: publicationDate.toISOString(), - discussionUrl: `${config.url}${router.asPath}/#comments`, + discussionUrl: `${articleUrl}/#comments`, editor: { '@id': `${config.url}/#branding` }, image: featuredImage?.sourceUrl, inLanguage: config.locales.defaultLocale, @@ -102,7 +103,7 @@ const SingleArticle: NextPageWithLayout = ({ post }) => { '@id': `${config.url}/blog`, }, license: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fr', - mainEntityOfPage: { '@id': `${config.url}${router.asPath}` }, + mainEntityOfPage: { '@id': `${articleUrl}` }, thumbnailUrl: featuredImage?.sourceUrl, }; @@ -116,6 +117,12 @@ const SingleArticle: NextPageWithLayout = ({ post }) => { {seo.title} + + + + + +