diff options
| -rw-r--r-- | package.json | 2 | ||||
| -rw-r--r-- | src/components/Branding/Branding.tsx | 13 | ||||
| -rw-r--r-- | src/components/Breadcrumb/Breadcrumb.tsx | 13 | ||||
| -rw-r--r-- | src/components/Comment/Comment.tsx | 13 | ||||
| -rw-r--r-- | src/components/Layouts/Layout.tsx | 15 | ||||
| -rw-r--r-- | src/components/PostPreview/PostPreview.tsx | 13 | ||||
| -rw-r--r-- | src/pages/article/[slug].tsx | 10 | ||||
| -rw-r--r-- | src/pages/blog/index.tsx | 10 | ||||
| -rw-r--r-- | src/pages/contact.tsx | 10 | ||||
| -rw-r--r-- | src/pages/cv.tsx | 10 | ||||
| -rw-r--r-- | src/pages/index.tsx | 10 | ||||
| -rw-r--r-- | src/pages/mentions-legales.tsx | 10 | ||||
| -rw-r--r-- | src/pages/projet/[slug].tsx | 10 | ||||
| -rw-r--r-- | src/pages/projets.tsx | 10 | ||||
| -rw-r--r-- | src/pages/sujet/[slug].tsx | 10 | ||||
| -rw-r--r-- | src/pages/thematique/[slug].tsx | 10 | ||||
| -rw-r--r-- | yarn.lock | 8 |
17 files changed, 94 insertions, 83 deletions
diff --git a/package.json b/package.json index c3a3a66..7a5123d 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "modern-normalize": "^1.1.0", "next": "^12.1.0", "next-sitemap": "^2.1.14", - "next-themes": "^0.0.15", + "next-themes": "^0.1.1", "prism-themes": "^1.9.0", "prismjs": "^1.25.0", "react": "^17.0.2", diff --git a/src/components/Branding/Branding.tsx b/src/components/Branding/Branding.tsx index 07b9259..c10fcf6 100644 --- a/src/components/Branding/Branding.tsx +++ b/src/components/Branding/Branding.tsx @@ -1,9 +1,9 @@ import photo from '@assets/images/armand-philippot.jpg'; import { settings } from '@utils/config'; -import Head from 'next/head'; import Image from 'next/image'; import Link from 'next/link'; import { useRouter } from 'next/router'; +import Script from 'next/script'; import { ReactElement, useEffect, useRef } from 'react'; import { useIntl } from 'react-intl'; import { Person, WithContext } from 'schema-dts'; @@ -62,12 +62,11 @@ const Branding: BrandingReturn = ({ isHome = false }) => { return ( <> - <Head> - <script - type="application/ld+json" - dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} - ></script> - </Head> + <Script + id="schema-branding" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + /> <div id="branding" className={styles.wrapper}> <div className={styles.logo} ref={logoRef}> <div className={styles.logo__front}> diff --git a/src/components/Breadcrumb/Breadcrumb.tsx b/src/components/Breadcrumb/Breadcrumb.tsx index 914a175..92350c0 100644 --- a/src/components/Breadcrumb/Breadcrumb.tsx +++ b/src/components/Breadcrumb/Breadcrumb.tsx @@ -1,7 +1,7 @@ import { settings } from '@utils/config'; -import Head from 'next/head'; import Link from 'next/link'; import { useRouter } from 'next/router'; +import Script from 'next/script'; import { useIntl } from 'react-intl'; import { BreadcrumbList, WithContext } from 'schema-dts'; import styles from './Breadcrumb.module.scss'; @@ -125,12 +125,11 @@ const Breadcrumb = ({ pageTitle }: { pageTitle: string }) => { return ( <> - <Head> - <script - type="application/ld+json" - dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} - ></script> - </Head> + <Script + id="schema-breadcrumb" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + /> {!isHome && ( <nav id="breadcrumb" className={styles.wrapper}> <span className="screen-reader-text"> diff --git a/src/components/Comment/Comment.tsx b/src/components/Comment/Comment.tsx index a263771..7215afe 100644 --- a/src/components/Comment/Comment.tsx +++ b/src/components/Comment/Comment.tsx @@ -3,10 +3,10 @@ import CommentForm from '@components/CommentForm/CommentForm'; import { Comment as CommentData } from '@ts/types/comments'; import { settings } from '@utils/config'; import { getFormattedDate } from '@utils/helpers/format'; -import Head from 'next/head'; import Image from 'next/image'; import Link from 'next/link'; import { useRouter } from 'next/router'; +import Script from 'next/script'; import { useEffect, useRef, useState } from 'react'; import { useIntl } from 'react-intl'; import { Comment as CommentSchema, WithContext } from 'schema-dts'; @@ -175,12 +175,11 @@ const Comment = ({ return ( <> - <Head> - <script - type="application/ld+json" - dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} - ></script> - </Head> + <Script + id="schema-comments" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + /> <li className={styles.item}> {comment.approved ? getApprovedComment() : getCommentStatus()} </li> diff --git a/src/components/Layouts/Layout.tsx b/src/components/Layouts/Layout.tsx index 9c29df9..845d6fa 100644 --- a/src/components/Layouts/Layout.tsx +++ b/src/components/Layouts/Layout.tsx @@ -101,18 +101,13 @@ const Layout = ({ <link rel="icon" href="/icon.svg" type="image/svg+xml" /> <link rel="apple-touch-icon" href="/apple-touch-icon.png" /> <link rel="manifest" href="/manifest.webmanifest" /> - <script - type="application/ld+json" - dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} - ></script> - <script - type="application/ld+json" - dangerouslySetInnerHTML={{ - __html: JSON.stringify(searchActionSchema), - }} - ></script> </Head> <Script + id="schema-layout" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + ></Script> + <Script strategy="afterInteractive" async src={`${settings.ackee.url}/${settings.ackee.filename}`} diff --git a/src/components/PostPreview/PostPreview.tsx b/src/components/PostPreview/PostPreview.tsx index 3fbfa63..8b20eca 100644 --- a/src/components/PostPreview/PostPreview.tsx +++ b/src/components/PostPreview/PostPreview.tsx @@ -5,11 +5,11 @@ import { TitleLevel } from '@ts/types/app'; import { ArticleMeta, ArticlePreview } from '@ts/types/articles'; import { settings } from '@utils/config'; import Image from 'next/image'; -import Head from 'next/head'; import Link from 'next/link'; import { FormattedMessage } from 'react-intl'; import { BlogPosting, WithContext } from 'schema-dts'; import styles from './PostPreview.module.scss'; +import Script from 'next/script'; const PostPreview = ({ post, @@ -68,12 +68,11 @@ const PostPreview = ({ return ( <> - <Head> - <script - type="application/ld+json" - dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} - ></script> - </Head> + <Script + id="schema-post-preview" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + /> <article className={styles.wrapper}> {featuredImage && Object.keys(featuredImage).length > 0 && ( <div className={styles.cover}> diff --git a/src/pages/article/[slug].tsx b/src/pages/article/[slug].tsx index 2fd1850..6d0ad5a 100644 --- a/src/pages/article/[slug].tsx +++ b/src/pages/article/[slug].tsx @@ -28,6 +28,7 @@ import { useEffect } from 'react'; import { useIntl } from 'react-intl'; import { Blog, BlogPosting, Graph, WebPage } from 'schema-dts'; import '@utils/plugins/prism-color-scheme'; +import Script from 'next/script'; const SingleArticle: NextPageWithLayout<ArticleProps> = ({ comments, @@ -168,11 +169,12 @@ const SingleArticle: NextPageWithLayout<ArticleProps> = ({ <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) }} - ></script> </Head> + <Script + id="schema-article" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + /> <article id="article" className={styles.article} diff --git a/src/pages/blog/index.tsx b/src/pages/blog/index.tsx index e725ea8..543fad9 100644 --- a/src/pages/blog/index.tsx +++ b/src/pages/blog/index.tsx @@ -20,6 +20,7 @@ import { getIntlInstance, loadTranslation } from '@utils/helpers/i18n'; import { GetStaticProps, GetStaticPropsContext } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; +import Script from 'next/script'; import { useEffect, useRef, useState } from 'react'; import { useIntl } from 'react-intl'; import { Blog as BlogSchema, Graph, WebPage } from 'schema-dts'; @@ -157,11 +158,12 @@ const Blog: NextPageWithLayout<BlogPageProps> = ({ <meta property="og:type" content="website" /> <meta property="og:title" content={title} /> <meta property="og:description" content={pageDescription} /> - <script - type="application/ld+json" - dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} - ></script> </Head> + <Script + id="schema-blog" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + /> <article id="blog" className={`${styles.article} ${styles['article--no-comments']}`} diff --git a/src/pages/contact.tsx b/src/pages/contact.tsx index 176d130..9f8ec0f 100644 --- a/src/pages/contact.tsx +++ b/src/pages/contact.tsx @@ -10,6 +10,7 @@ import { getIntlInstance, loadTranslation } from '@utils/helpers/i18n'; import { GetStaticProps, GetStaticPropsContext } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; +import Script from 'next/script'; import { useIntl } from 'react-intl'; import { ContactPage as ContactPageSchema, Graph, WebPage } from 'schema-dts'; @@ -82,11 +83,12 @@ const ContactPage: NextPageWithLayout = () => { <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) }} - ></script> </Head> + <Script + id="schema-contact" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + /> <article id="contact" className={`${styles.article} ${styles['article--no-comments']}`} diff --git a/src/pages/cv.tsx b/src/pages/cv.tsx index e77c586..39dfeed 100644 --- a/src/pages/cv.tsx +++ b/src/pages/cv.tsx @@ -11,6 +11,7 @@ import { loadTranslation } from '@utils/helpers/i18n'; import { GetStaticProps, GetStaticPropsContext } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; +import Script from 'next/script'; import { useIntl } from 'react-intl'; import { AboutPage, Graph, WebPage } from 'schema-dts'; @@ -100,11 +101,12 @@ const CV: NextPageWithLayout = () => { <meta property="og:description" content={intro} /> <meta property="og:image" content={image} /> <meta property="og:image:alt" content={title} /> - <script - type="application/ld+json" - dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} - ></script> </Head> + <Script + id="schema-cv" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + /> <article id="cv" className={`${styles.article} ${styles['article--no-comments']}`} diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 5621d58..0045996 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -12,6 +12,7 @@ import { settings } from '@utils/config'; import { loadTranslation } from '@utils/helpers/i18n'; import { GetStaticProps, GetStaticPropsContext } from 'next'; import Head from 'next/head'; +import Script from 'next/script'; import type { ReactElement } from 'react'; import { useIntl } from 'react-intl'; import { Graph, WebPage } from 'schema-dts'; @@ -193,11 +194,12 @@ const Home: NextPageWithLayout<HomePageProps> = ({ <meta property="og:url" content={`${settings.url}`} /> <meta property="og:title" content={pageTitle} /> <meta property="og:description" content={pageDescription} /> - <script - type="application/ld+json" - dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} - ></script> </Head> + <Script + id="schema-homepage" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + /> <div id="home"> <HomePageContent components={components} /> </div> diff --git a/src/pages/mentions-legales.tsx b/src/pages/mentions-legales.tsx index 0b92294..67c4a97 100644 --- a/src/pages/mentions-legales.tsx +++ b/src/pages/mentions-legales.tsx @@ -14,6 +14,7 @@ import { loadTranslation } from '@utils/helpers/i18n'; import { GetStaticProps, GetStaticPropsContext } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; +import Script from 'next/script'; import { useIntl } from 'react-intl'; import { Article, Graph, WebPage } from 'schema-dts'; @@ -97,11 +98,12 @@ const LegalNotice: NextPageWithLayout = () => { <meta property="og:type" content="article" /> <meta property="og:title" content={pageTitle} /> <meta property="og:description" content={intro} /> - <script - type="application/ld+json" - dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} - ></script> </Head> + <Script + id="schema-legal-notice" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + /> <article id="legal-notice" className={`${styles.article} ${styles['article--no-comments']}`} diff --git a/src/pages/projet/[slug].tsx b/src/pages/projet/[slug].tsx index fe62f0e..51f3d0b 100644 --- a/src/pages/projet/[slug].tsx +++ b/src/pages/projet/[slug].tsx @@ -20,6 +20,7 @@ import { MDXComponents, NestedMDXComponents } from 'mdx/types'; import { GetStaticPaths, GetStaticProps, GetStaticPropsContext } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; +import Script from 'next/script'; import { ParsedUrlQuery } from 'querystring'; import { ComponentType } from 'react'; import { useIntl } from 'react-intl'; @@ -100,11 +101,12 @@ const Project: NextPageWithLayout<ProjectProps> = ({ <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) }} - ></script> </Head> + <Script + id="schema-project" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + /> <article id="project" className={`${styles.article} ${styles['article--no-comments']}`} diff --git a/src/pages/projets.tsx b/src/pages/projets.tsx index 998c67f..7fb7187 100644 --- a/src/pages/projets.tsx +++ b/src/pages/projets.tsx @@ -10,6 +10,7 @@ import { getSortedProjects } from '@utils/helpers/projects'; import { GetStaticProps, GetStaticPropsContext } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; +import Script from 'next/script'; import { useIntl } from 'react-intl'; import { Article, Graph, WebPage } from 'schema-dts'; @@ -86,11 +87,12 @@ const Projects = ({ projects }: { projects: Project[] }) => { <meta property="og:type" content="article" /> <meta property="og:title" content={meta.title} /> <meta property="og:description" content={pageDescription} /> - <script - type="application/ld+json" - dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} - ></script> </Head> + <Script + id="schema-projects" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + /> <article id="projects" className={styles.article}> <PostHeader title={meta.title} intro={<PageContent />} /> <div className={styles.body}> diff --git a/src/pages/sujet/[slug].tsx b/src/pages/sujet/[slug].tsx index dc5ee7e..bb22a88 100644 --- a/src/pages/sujet/[slug].tsx +++ b/src/pages/sujet/[slug].tsx @@ -19,6 +19,7 @@ import { loadTranslation } from '@utils/helpers/i18n'; import { GetStaticPaths, GetStaticProps, GetStaticPropsContext } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; +import Script from 'next/script'; import { ParsedUrlQuery } from 'querystring'; import { useRef } from 'react'; import { useIntl } from 'react-intl'; @@ -116,11 +117,12 @@ const Topic: NextPageWithLayout<TopicProps> = ({ topic, allTopics }) => { <meta property="og:description" content={topic.intro} /> <meta property="og:image" content={topic.featuredImage?.sourceUrl} /> <meta property="og:image:alt" content={topic.featuredImage?.altText} /> - <script - type="application/ld+json" - dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} - ></script> </Head> + <Script + id="schema-subject" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + /> <article id="topic" className={`${styles.article} ${styles['article--no-comments']}`} diff --git a/src/pages/thematique/[slug].tsx b/src/pages/thematique/[slug].tsx index a8cb478..edc4296 100644 --- a/src/pages/thematique/[slug].tsx +++ b/src/pages/thematique/[slug].tsx @@ -19,6 +19,7 @@ import { loadTranslation } from '@utils/helpers/i18n'; import { GetStaticPaths, GetStaticProps, GetStaticPropsContext } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; +import Script from 'next/script'; import { ParsedUrlQuery } from 'querystring'; import { useRef } from 'react'; import { useIntl } from 'react-intl'; @@ -111,11 +112,12 @@ const Thematic: NextPageWithLayout<ThematicProps> = ({ <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) }} - ></script> </Head> + <Script + id="schema-thematic" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} + /> <article id="thematic" className={`${styles.article} ${styles['article--no-comments']}`} @@ -6170,10 +6170,10 @@ next-sitemap@^2.1.14: "@corex/deepmerge" "^2.6.148" minimist "^1.2.5" -next-themes@^0.0.15: - version "0.0.15" - resolved "https://registry.yarnpkg.com/next-themes/-/next-themes-0.0.15.tgz#ab0cee69cd763b77d41211f631e108beab39bf7d" - integrity sha512-LTmtqYi03c4gMTJmWwVK9XkHL7h0/+XrtR970Ujvtu3s0kZNeJN24aJsi4rkZOI8i19+qq6f8j+8Duwy5jqcrQ== +next-themes@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/next-themes/-/next-themes-0.1.1.tgz#122113a458bf1d1be5ffed66778ab924c106f82a" + integrity sha512-Iqxt6rhS/KfK/iHJ0tfFjTcdLEAI0AgwFuAFrMwLOPK5e+MI3I+fzyvBoS+VaOS+NldUiazurhgwYhrfV0VXsQ== next@^12.1.0: version "12.1.0" |
