Replace react-helmet with next/head

This commit is contained in:
Marcus Blättermann 2022-11-30 02:12:54 +01:00
parent de902ca878
commit 47ce9ca870
No known key found for this signature in database
GPG Key ID: A1E1F04008AC450D
4 changed files with 9 additions and 64 deletions

View File

@ -33,7 +33,6 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-github-btn": "^1.4.0",
"react-helmet": "^6.1.0",
"react-inlinesvg": "^3.0.1",
"react-intersection-observer": "^9.4.0",
"remark": "^14.0.2",
@ -6540,11 +6539,6 @@
"react": "^18.2.0"
}
},
"node_modules/react-fast-compare": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.0.tgz",
"integrity": "sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA=="
},
"node_modules/react-from-dom": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/react-from-dom/-/react-from-dom-0.6.2.tgz",
@ -6564,20 +6558,6 @@
"react": ">=16.3.0"
}
},
"node_modules/react-helmet": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/react-helmet/-/react-helmet-6.1.0.tgz",
"integrity": "sha512-4uMzEY9nlDlgxr61NL3XbKRy1hEkXmKNXhjbAIOVw5vcFrsdYbH2FEwcNyWvWinl103nXgzYNlns9ca+8kFiWw==",
"dependencies": {
"object-assign": "^4.1.1",
"prop-types": "^15.7.2",
"react-fast-compare": "^3.1.1",
"react-side-effect": "^2.1.0"
},
"peerDependencies": {
"react": ">=16.3.0"
}
},
"node_modules/react-inlinesvg": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/react-inlinesvg/-/react-inlinesvg-3.0.1.tgz",
@ -6603,14 +6583,6 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
},
"node_modules/react-side-effect": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-2.1.2.tgz",
"integrity": "sha512-PVjOcvVOyIILrYoyGEpDN3vmYNLdy1CajSFNt4TDsVQC5KpTijDvWVoR+/7Rz2xT978D8/ZtFceXxzsPwZEDvw==",
"peerDependencies": {
"react": "^16.3.0 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
@ -13227,11 +13199,6 @@
"scheduler": "^0.23.0"
}
},
"react-fast-compare": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.0.tgz",
"integrity": "sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA=="
},
"react-from-dom": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/react-from-dom/-/react-from-dom-0.6.2.tgz",
@ -13246,17 +13213,6 @@
"github-buttons": "^2.22.0"
}
},
"react-helmet": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/react-helmet/-/react-helmet-6.1.0.tgz",
"integrity": "sha512-4uMzEY9nlDlgxr61NL3XbKRy1hEkXmKNXhjbAIOVw5vcFrsdYbH2FEwcNyWvWinl103nXgzYNlns9ca+8kFiWw==",
"requires": {
"object-assign": "^4.1.1",
"prop-types": "^15.7.2",
"react-fast-compare": "^3.1.1",
"react-side-effect": "^2.1.0"
}
},
"react-inlinesvg": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/react-inlinesvg/-/react-inlinesvg-3.0.1.tgz",
@ -13277,12 +13233,6 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
},
"react-side-effect": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-2.1.2.tgz",
"integrity": "sha512-PVjOcvVOyIILrYoyGEpDN3vmYNLdy1CajSFNt4TDsVQC5KpTijDvWVoR+/7Rz2xT978D8/ZtFceXxzsPwZEDvw==",
"requires": {}
},
"readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",

View File

@ -36,7 +36,6 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-github-btn": "^1.4.0",
"react-helmet": "^6.1.0",
"react-inlinesvg": "^3.0.1",
"react-intersection-observer": "^9.4.0",
"remark": "^14.0.2",

View File

@ -1,6 +1,5 @@
import React from 'react'
import PropTypes from 'prop-types'
import Helmet from 'react-helmet'
import socialImageDefault from '../images/social_default.jpg'
import socialImageApi from '../images/social_api.jpg'
@ -8,6 +7,7 @@ import socialImageUniverse from '../images/social_universe.jpg'
import socialImageNightly from '../images/social_nightly.jpg'
import socialImageLegacy from '../images/social_legacy.jpg'
import siteMetadata from '../../meta/site.json'
import Head from 'next/head'
function getPageTitle(title, sitename, slogan, sectionTitle, nightly, legacy) {
if (sectionTitle && title) {
@ -34,7 +34,6 @@ export default function SEO({
title,
section,
sectionTitle,
bodyClass,
nightly,
legacy,
}) {
@ -104,19 +103,17 @@ export default function SEO({
]
return (
<Helmet
defer={false}
htmlAttributes={{ lang }}
bodyAttributes={{ class: bodyClass }}
title={pageTitle}
meta={meta}
/>
<Head>
<title>{pageTitle}</title>
{meta.map((item, index) => (
<meta key={index} {...item} />
))}
</Head>
)
}
SEO.propTypes = {
description: PropTypes.string,
lang: PropTypes.string,
meta: PropTypes.array,
keywords: PropTypes.arrayOf(PropTypes.string),
title: PropTypes.string,

View File

@ -102,13 +102,12 @@ class Layout extends React.Component {
const isDocs = ['usage', 'models', 'api', 'styleguide'].includes(section)
return (
<>
<div className={bodyClass}>
<SEO
title={title}
description={teaser || siteMetadata.description}
section={section}
sectionTitle={sectionTitle}
bodyClass={bodyClass}
nightly={nightly}
/>
<AlertSpace nightly={nightly} legacy={legacy} />
@ -131,7 +130,7 @@ class Layout extends React.Component {
<Footer wide />
</div>
)}
</>
</div>
)
}
}