diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/Layouts/Layout.tsx | 8 | ||||
| -rw-r--r-- | src/config/website.ts | 1 | ||||
| -rw-r--r-- | src/pages/article/[slug].tsx | 17 | ||||
| -rw-r--r-- | src/pages/blog/index.tsx | 13 | ||||
| -rw-r--r-- | src/pages/contact.tsx | 11 | ||||
| -rw-r--r-- | src/pages/cv.tsx | 13 | ||||
| -rw-r--r-- | src/pages/index.tsx | 4 | ||||
| -rw-r--r-- | src/pages/mentions-legales.tsx | 11 | ||||
| -rw-r--r-- | src/pages/sujet/[slug].tsx | 14 | ||||
| -rw-r--r-- | src/pages/thematique/[slug].tsx | 9 | 
10 files changed, 80 insertions, 21 deletions
| 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 (      <>        <Head> +        <meta property="og:site_name" content={config.name} /> +        <meta +          property="og:locale" +          content={`${config.locales.defaultLocale}_${config.locales.defaultCountry}`} +        /> +        <meta property="twitter:card" content="summary" /> +        <meta property="twitter:site" content={config.twitterId} /> +        <meta property="twitter:creator" content={config.twitterId} />          <link            rel="alternate"            href="/feed.xml" diff --git a/src/config/website.ts b/src/config/website.ts index 12645a7..1b0e2d3 100644 --- a/src/config/website.ts +++ b/src/config/website.ts @@ -12,5 +12,6 @@ export const config = {      defaultCountry: 'FR',    },    postsPerPage: 10, +  twitterId: '@ArmandPhilippot',    url: process.env.NEXT_PUBLIC_FRONTEND_URL,  }; diff --git a/src/pages/article/[slug].tsx b/src/pages/article/[slug].tsx index 70a12dc..b9c0021 100644 --- a/src/pages/article/[slug].tsx +++ b/src/pages/article/[slug].tsx @@ -44,6 +44,7 @@ const SingleArticle: NextPageWithLayout<ArticleProps> = ({ 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<ArticleProps> = ({ 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<ArticleProps> = ({ 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<ArticleProps> = ({ 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<ArticleProps> = ({ 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<ArticleProps> = ({ post }) => {        <Head>          <title>{seo.title}</title>          <meta name="description" content={seo.metaDesc} /> +        <meta property="og:url" content={`${articleUrl}`} /> +        <meta property="og:type" content="article" /> +        <meta property="og:title" content={title} /> +        <meta property="og:description" content={intro} /> +        <meta property="og:image" content={featuredImage?.sourceUrl} /> +        <meta property="og:image:alt" content={featuredImage?.altText} />          <script            type="application/ld+json"            dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} diff --git a/src/pages/blog/index.tsx b/src/pages/blog/index.tsx index bb16d37..3b3f2c2 100644 --- a/src/pages/blog/index.tsx +++ b/src/pages/blog/index.tsx @@ -62,8 +62,11 @@ const Blog: NextPageWithLayout<BlogPageProps> = ({ fallback }) => {      return <PostsList ref={lastPostRef} data={data} showYears={true} />;    }; +  const title = t`Blog`; +  const pageUrl = `${config.url}${router.asPath}`; +    const webpageSchema: WebPage = { -    '@id': `${config.url}${router.asPath}`, +    '@id': `${pageUrl}`,      '@type': 'WebPage',      breadcrumb: { '@id': `${config.url}/#breadcrumb` },      name: seo.blog.title, @@ -84,7 +87,7 @@ const Blog: NextPageWithLayout<BlogPageProps> = ({ fallback }) => {      editor: { '@id': `${config.url}/#branding` },      inLanguage: config.locales.defaultLocale,      license: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fr', -    mainEntityOfPage: { '@id': `${config.url}${router.asPath}` }, +    mainEntityOfPage: { '@id': `${pageUrl}` },    };    const schemaJsonLd: Graph = { @@ -97,6 +100,10 @@ const Blog: NextPageWithLayout<BlogPageProps> = ({ fallback }) => {        <Head>          <title>{seo.blog.title}</title>          <meta name="description" content={seo.blog.description} /> +        <meta property="og:url" content={`${pageUrl}`} /> +        <meta property="og:type" content="website" /> +        <meta property="og:title" content={title} /> +        <meta property="og:description" content={seo.blog.description} />          <script            type="application/ld+json"            dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} @@ -106,7 +113,7 @@ const Blog: NextPageWithLayout<BlogPageProps> = ({ fallback }) => {          id="blog"          className={`${styles.article} ${styles['article--no-comments']}`}        > -        <PostHeader title={t`Blog`} /> +        <PostHeader title={title} />          <div className={styles.body}>            {getPostsList()}            {hasNextPage && ( diff --git a/src/pages/contact.tsx b/src/pages/contact.tsx index 659da8a..66f4f9e 100644 --- a/src/pages/contact.tsx +++ b/src/pages/contact.tsx @@ -58,15 +58,16 @@ const ContactPage: NextPageWithLayout = () => {    const title = t`Contact`;    const intro = t`Please fill the form to contact me.`; +  const pageUrl = `${config.url}${router.asPath}`;    const webpageSchema: WebPage = { -    '@id': `${config.url}${router.asPath}`, +    '@id': `${pageUrl}`,      '@type': 'WebPage',      breadcrumb: { '@id': `${config.url}/#breadcrumb` },      name: seo.contact.title,      description: seo.contact.description,      reviewedBy: { '@id': `${config.url}/#branding` }, -    url: `${config.url}${router.asPath}`, +    url: `${pageUrl}`,      isPartOf: {        '@id': `${config.url}`,      }, @@ -82,7 +83,7 @@ const ContactPage: NextPageWithLayout = () => {      editor: { '@id': `${config.url}/#branding` },      inLanguage: config.locales.defaultLocale,      license: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fr', -    mainEntityOfPage: { '@id': `${config.url}${router.asPath}` }, +    mainEntityOfPage: { '@id': `${pageUrl}` },    };    const schemaJsonLd: Graph = { @@ -95,6 +96,10 @@ const ContactPage: NextPageWithLayout = () => {        <Head>          <title>{seo.contact.title}</title>          <meta name="description" content={seo.contact.description} /> +        <meta property="og:url" content={`${pageUrl}`} /> +        <meta property="og:type" content="article" /> +        <meta property="og:title" content={title} /> +        <meta property="og:description" content={intro} />          <script            type="application/ld+json"            dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} diff --git a/src/pages/cv.tsx b/src/pages/cv.tsx index ac5841e..47093c4 100644 --- a/src/pages/cv.tsx +++ b/src/pages/cv.tsx @@ -25,15 +25,16 @@ const CV: NextPageWithLayout = () => {    const pageMeta: ArticleMeta = {      dates,    }; +  const pageUrl = `${config.url}${router.asPath}`;    const webpageSchema: WebPage = { -    '@id': `${config.url}${router.asPath}`, +    '@id': `${pageUrl}`,      '@type': 'WebPage',      breadcrumb: { '@id': `${config.url}/#breadcrumb` },      name: seo.cv.title,      description: seo.cv.description,      reviewedBy: { '@id': `${config.url}/#branding` }, -    url: `${config.url}${router.asPath}`, +    url: `${pageUrl}`,      isPartOf: {        '@id': `${config.url}`,      }, @@ -57,7 +58,7 @@ const CV: NextPageWithLayout = () => {      inLanguage: config.locales.defaultLocale,      license: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fr',      thumbnailUrl: image, -    mainEntityOfPage: { '@id': `${config.url}${router.asPath}` }, +    mainEntityOfPage: { '@id': `${pageUrl}` },    };    const schemaJsonLd: Graph = { @@ -70,6 +71,12 @@ const CV: NextPageWithLayout = () => {        <Head>          <title>{seo.cv.title}</title>          <meta name="description" content={seo.cv.description} /> +        <meta property="og:url" content={`${pageUrl}`} /> +        <meta property="og:type" content="article" /> +        <meta property="og:title" content={`${config.name} CV`} /> +        <meta property="og:description" content={intro} /> +        <meta property="og:image" content={image} /> +        <meta property="og:image:alt" content={`${config.name} CV`} />          <script            type="application/ld+json"            dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 32f1373..bc89334 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -117,6 +117,10 @@ const Home: NextPageWithLayout = () => {        <Head>          <title>{seo.homepage.title}</title>          <meta name="description" content={seo.homepage.description} /> +        <meta property="og:type" content="website" /> +        <meta property="og:url" content={`${config.url}`} /> +        <meta property="og:title" content={seo.homepage.title} /> +        <meta property="og:description" content={seo.homepage.description} />          <script            type="application/ld+json"            dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} diff --git a/src/pages/mentions-legales.tsx b/src/pages/mentions-legales.tsx index e7da49a..ac587f0 100644 --- a/src/pages/mentions-legales.tsx +++ b/src/pages/mentions-legales.tsx @@ -28,12 +28,13 @@ const LegalNotice: NextPageWithLayout = () => {    const pageMeta: ArticleMeta = {      dates,    }; +  const pageUrl = `${config.url}${router.asPath}`;    const publicationDate = new Date(dates.publication);    const updateDate = new Date(dates.update);    const webpageSchema: WebPage = { -    '@id': `${config.url}${router.asPath}`, +    '@id': `${pageUrl}`,      '@type': 'WebPage',      breadcrumb: { '@id': `${config.url}/#breadcrumb` },      name: seo.legalNotice.title, @@ -41,7 +42,7 @@ const LegalNotice: NextPageWithLayout = () => {      inLanguage: config.locales.defaultLocale,      license: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fr',      reviewedBy: { '@id': `${config.url}/#branding` }, -    url: `${config.url}${router.asPath}`, +    url: `${pageUrl}`,      isPartOf: {        '@id': `${config.url}`,      }, @@ -61,7 +62,7 @@ const LegalNotice: NextPageWithLayout = () => {      editor: { '@id': `${config.url}/#branding` },      inLanguage: config.locales.defaultLocale,      license: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fr', -    mainEntityOfPage: { '@id': `${config.url}${router.asPath}` }, +    mainEntityOfPage: { '@id': `${pageUrl}` },    };    const schemaJsonLd: Graph = { @@ -74,6 +75,10 @@ const LegalNotice: NextPageWithLayout = () => {        <Head>          <title>{seo.legalNotice.title}</title>          <meta name="description" content={seo.legalNotice.description} /> +        <meta property="og:url" content={`${pageUrl}`} /> +        <meta property="og:type" content="article" /> +        <meta property="og:title" content={t`Legal notice`} /> +        <meta property="og:description" content={intro} />          <script            type="application/ld+json"            dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} diff --git a/src/pages/sujet/[slug].tsx b/src/pages/sujet/[slug].tsx index bc87845..6c72cf9 100644 --- a/src/pages/sujet/[slug].tsx +++ b/src/pages/sujet/[slug].tsx @@ -52,9 +52,10 @@ const Subject: NextPageWithLayout<SubjectProps> = ({ subject }) => {      dates: subject.dates,      website: subject.officialWebsite,    }; +  const subjectUrl = `${config.url}${router.asPath}`;    const webpageSchema: WebPage = { -    '@id': `${config.url}${router.asPath}`, +    '@id': `${subjectUrl}`,      '@type': 'WebPage',      breadcrumb: { '@id': `${config.url}/#breadcrumb` },      name: subject.seo.title, @@ -87,7 +88,7 @@ const Subject: NextPageWithLayout<SubjectProps> = ({ subject }) => {      inLanguage: config.locales.defaultLocale,      isPartOf: { '@id': `${config.url}/blog` },      license: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fr', -    mainEntityOfPage: { '@id': `${config.url}${router.asPath}` }, +    mainEntityOfPage: { '@id': `${subjectUrl}` },      subjectOf: { '@id': `${config.url}/blog` },    }; @@ -101,6 +102,15 @@ const Subject: NextPageWithLayout<SubjectProps> = ({ subject }) => {        <Head>          <title>{subject.seo.title}</title>          <meta name="description" content={subject.seo.metaDesc} /> +        <meta property="og:url" content={`${subjectUrl}`} /> +        <meta property="og:type" content="article" /> +        <meta property="og:title" content={subject.title} /> +        <meta property="og:description" content={subject.intro} /> +        <meta property="og:image" content={subject.featuredImage?.sourceUrl} /> +        <meta +          property="og:image:alt" +          content={subject.featuredImage?.altText} +        />          <script            type="application/ld+json"            dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} diff --git a/src/pages/thematique/[slug].tsx b/src/pages/thematique/[slug].tsx index 1964146..93b1221 100644 --- a/src/pages/thematique/[slug].tsx +++ b/src/pages/thematique/[slug].tsx @@ -51,9 +51,10 @@ const Thematic: NextPageWithLayout<ThematicProps> = ({ thematic }) => {    const meta: ArticleMeta = {      dates: thematic.dates,    }; +  const thematicUrl = `${config.url}${router.asPath}`;    const webpageSchema: WebPage = { -    '@id': `${config.url}${router.asPath}`, +    '@id': `${thematicUrl}`,      '@type': 'WebPage',      breadcrumb: { '@id': `${config.url}/#breadcrumb` },      name: thematic.seo.title, @@ -81,7 +82,7 @@ const Thematic: NextPageWithLayout<ThematicProps> = ({ thematic }) => {      inLanguage: config.locales.defaultLocale,      isPartOf: { '@id': `${config.url}/blog` },      license: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fr', -    mainEntityOfPage: { '@id': `${config.url}${router.asPath}` }, +    mainEntityOfPage: { '@id': `${thematicUrl}` },      subjectOf: { '@id': `${config.url}/blog` },    }; @@ -95,6 +96,10 @@ const Thematic: NextPageWithLayout<ThematicProps> = ({ thematic }) => {        <Head>          <title>{thematic.seo.title}</title>          <meta name="description" content={thematic.seo.metaDesc} /> +        <meta property="og:url" content={`${thematic}`} /> +        <meta property="og:type" content="article" /> +        <meta property="og:title" content={thematic.title} /> +        <meta property="og:description" content={thematic.intro} />          <script            type="application/ld+json"            dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} | 
