diff --git a/starters/blog/gatsby-config.js b/starters/blog/gatsby-config.js index 0c25b5c259a92..799682b0d9180 100644 --- a/starters/blog/gatsby-config.js +++ b/starters/blog/gatsby-config.js @@ -124,7 +124,6 @@ module.exports = { icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site. }, }, - `gatsby-plugin-react-helmet`, // this (optional) plugin enables Progressive Web App + Offline functionality // To learn more, visit: https://gatsby.dev/offline // `gatsby-plugin-offline`, diff --git a/starters/blog/gatsby-ssr.js b/starters/blog/gatsby-ssr.js new file mode 100644 index 0000000000000..5500b627a86c4 --- /dev/null +++ b/starters/blog/gatsby-ssr.js @@ -0,0 +1,9 @@ +/** + * Implement Gatsby's SSR (Server Side Rendering) APIs in this file. + * + * See: https://www.gatsbyjs.com/docs/ssr-apis/ + */ + +exports.onRenderBody = ({ setHtmlAttributes }) => { + setHtmlAttributes({ lang: `en` }) +} diff --git a/starters/blog/package-lock.json b/starters/blog/package-lock.json index b3911ec27866a..cbe836992743e 100644 --- a/starters/blog/package-lock.json +++ b/starters/blog/package-lock.json @@ -7643,14 +7643,6 @@ "lodash": "^4.17.21" } }, - "gatsby-plugin-react-helmet": { - "version": "5.19.0", - "resolved": "https://registry.npmjs.org/gatsby-plugin-react-helmet/-/gatsby-plugin-react-helmet-5.19.0.tgz", - "integrity": "sha512-XXrJYfHqoaUe57oAF+/ljPHncrvYk0UonES3aUwynbWsR8UXhQpdbwqIOYZPGQgPsc1X55Kzdo+/3pU1gA9ajQ==", - "requires": { - "@babel/runtime": "^7.15.4" - } - }, "gatsby-plugin-sharp": { "version": "4.19.0", "resolved": "https://registry.npmjs.org/gatsby-plugin-sharp/-/gatsby-plugin-sharp-4.19.0.tgz", @@ -12159,22 +12151,6 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz", "integrity": "sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==" }, - "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-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-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -12190,11 +12166,6 @@ "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.9.0.tgz", "integrity": "sha512-Gvzk7OZpiqKSkxsQvO/mbTN1poglhmAV7gR/DdIrRrSMXraRQQlfikRJOr3Nb9GTMPC5kof948Zy6jJZIFtDvQ==" }, - "react-side-effect": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-2.1.1.tgz", - "integrity": "sha512-2FoTQzRNTncBVtnzxFOk2mCpcfxQpenBMbk5kSVBg5UcPqV9fRbgY2zhb7GTWWOlpFmAxhClBDlIq8Rsubz1yQ==" - }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", diff --git a/starters/blog/package.json b/starters/blog/package.json index 77fc11a00342c..140a4af9e90c3 100644 --- a/starters/blog/package.json +++ b/starters/blog/package.json @@ -15,7 +15,6 @@ "gatsby-plugin-image": "^2.19.0", "gatsby-plugin-manifest": "^4.19.0", "gatsby-plugin-offline": "^5.19.0", - "gatsby-plugin-react-helmet": "^5.19.0", "gatsby-plugin-sharp": "^4.19.0", "gatsby-remark-copy-linked-files": "^5.19.0", "gatsby-remark-images": "^6.19.0", @@ -28,7 +27,6 @@ "prismjs": "^1.28.0", "react": "^18.1.0", "react-dom": "^18.1.0", - "react-helmet": "^6.1.0", "typeface-merriweather": "0.0.72", "typeface-montserrat": "0.0.75" }, diff --git a/starters/blog/src/components/seo.js b/starters/blog/src/components/seo.js index 40fe5ea2d4308..0f1cfe10096ab 100644 --- a/starters/blog/src/components/seo.js +++ b/starters/blog/src/components/seo.js @@ -7,10 +7,9 @@ import * as React from "react" import PropTypes from "prop-types" -import { Helmet } from "react-helmet" import { useStaticQuery, graphql } from "gatsby" -const Seo = ({ description, lang, meta, title }) => { +const Seo = ({ description, lang, title, children }) => { const { site } = useStaticQuery( graphql` query { @@ -31,60 +30,30 @@ const Seo = ({ description, lang, meta, title }) => { const defaultTitle = site.siteMetadata?.title return ( - + <> + {defaultTitle ? `${title} | ${defaultTitle}` : title} + + + + + + + + + {children} + ) } Seo.defaultProps = { - lang: `en`, - meta: [], description: ``, } Seo.propTypes = { description: PropTypes.string, - lang: PropTypes.string, - meta: PropTypes.arrayOf(PropTypes.object), title: PropTypes.string.isRequired, } diff --git a/starters/blog/src/pages/404.js b/starters/blog/src/pages/404.js index 1df09ff33c45d..4eeb14ce4c8f1 100644 --- a/starters/blog/src/pages/404.js +++ b/starters/blog/src/pages/404.js @@ -9,13 +9,14 @@ const NotFoundPage = ({ data, location }) => { return ( -

404: Not Found

You just hit a route that doesn't exist... the sadness.

) } +export const Head = () => + export default NotFoundPage export const pageQuery = graphql` diff --git a/starters/blog/src/pages/index.js b/starters/blog/src/pages/index.js index 0e1cb233effa7..b8393b38a52a3 100644 --- a/starters/blog/src/pages/index.js +++ b/starters/blog/src/pages/index.js @@ -12,7 +12,6 @@ const BlogIndex = ({ data, location }) => { if (posts.length === 0) { return ( -

No blog posts found. Add markdown posts to "content/blog" (or the @@ -25,7 +24,6 @@ const BlogIndex = ({ data, location }) => { return ( -

    {posts.map(post => { @@ -65,6 +63,8 @@ const BlogIndex = ({ data, location }) => { export default BlogIndex +export const Head = () => + export const pageQuery = graphql` query { site { diff --git a/starters/blog/src/pages/using-typescript.tsx b/starters/blog/src/pages/using-typescript.tsx index fedd7c898d5ef..bdec46c05091f 100644 --- a/starters/blog/src/pages/using-typescript.tsx +++ b/starters/blog/src/pages/using-typescript.tsx @@ -1,6 +1,6 @@ // If you don't want to use TypeScript you can delete this file! import * as React from "react" -import { PageProps, Link, graphql } from "gatsby" +import { PageProps, Link, graphql, HeadFC } from "gatsby" import Layout from "../components/layout" import Seo from "../components/seo" @@ -17,7 +17,6 @@ const UsingTypescript: React.FC> = ({ location, }) => ( -

    Gatsby supports TypeScript by default!

    This means that you can create and write .ts/.tsx files for your @@ -43,6 +42,8 @@ const UsingTypescript: React.FC> = ({ ) +export const Head: HeadFC = () => + export default UsingTypescript export const query = graphql` diff --git a/starters/blog/src/templates/blog-post.js b/starters/blog/src/templates/blog-post.js index 5794890ba3e27..ce425ce18f954 100644 --- a/starters/blog/src/templates/blog-post.js +++ b/starters/blog/src/templates/blog-post.js @@ -5,17 +5,14 @@ import Bio from "../components/bio" import Layout from "../components/layout" import Seo from "../components/seo" -const BlogPostTemplate = ({ data, location }) => { - const post = data.markdownRemark - const siteTitle = data.site.siteMetadata?.title || `Title` - const { previous, next } = data +const BlogPostTemplate = ({ + data: { previous, next, site, markdownRemark: post }, + location, +}) => { + const siteTitle = site.siteMetadata?.title || `Title` return ( -

    { ) } +export const Head = ({ data: { markdownRemark: post } }) => { + return ( + + ) +} + export default BlogPostTemplate export const pageQuery = graphql` diff --git a/starters/default/gatsby-config.js b/starters/default/gatsby-config.js index 9678eccb1dc19..0d70c8ccde116 100644 --- a/starters/default/gatsby-config.js +++ b/starters/default/gatsby-config.js @@ -6,7 +6,6 @@ module.exports = { siteUrl: `https://gatsbystarterdefaultsource.gatsbyjs.io/`, }, plugins: [ - `gatsby-plugin-react-helmet`, `gatsby-plugin-image`, { resolve: `gatsby-source-filesystem`, diff --git a/starters/default/gatsby-ssr.js b/starters/default/gatsby-ssr.js index 01d83255f4f2c..5500b627a86c4 100644 --- a/starters/default/gatsby-ssr.js +++ b/starters/default/gatsby-ssr.js @@ -4,4 +4,6 @@ * See: https://www.gatsbyjs.com/docs/ssr-apis/ */ -// You can delete this file if you're not using it +exports.onRenderBody = ({ setHtmlAttributes }) => { + setHtmlAttributes({ lang: `en` }) +} diff --git a/starters/default/package-lock.json b/starters/default/package-lock.json index 0824c25c6b1aa..c09fc3ed98f83 100644 --- a/starters/default/package-lock.json +++ b/starters/default/package-lock.json @@ -7469,14 +7469,6 @@ "lodash": "^4.17.21" } }, - "gatsby-plugin-react-helmet": { - "version": "5.19.0", - "resolved": "https://registry.npmjs.org/gatsby-plugin-react-helmet/-/gatsby-plugin-react-helmet-5.19.0.tgz", - "integrity": "sha512-XXrJYfHqoaUe57oAF+/ljPHncrvYk0UonES3aUwynbWsR8UXhQpdbwqIOYZPGQgPsc1X55Kzdo+/3pU1gA9ajQ==", - "requires": { - "@babel/runtime": "^7.15.4" - } - }, "gatsby-plugin-sharp": { "version": "4.19.0", "resolved": "https://registry.npmjs.org/gatsby-plugin-sharp/-/gatsby-plugin-sharp-4.19.0.tgz", @@ -11360,22 +11352,6 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz", "integrity": "sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==" }, - "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-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-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -11391,11 +11367,6 @@ "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.9.0.tgz", "integrity": "sha512-Gvzk7OZpiqKSkxsQvO/mbTN1poglhmAV7gR/DdIrRrSMXraRQQlfikRJOr3Nb9GTMPC5kof948Zy6jJZIFtDvQ==" }, - "react-side-effect": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-2.1.1.tgz", - "integrity": "sha512-2FoTQzRNTncBVtnzxFOk2mCpcfxQpenBMbk5kSVBg5UcPqV9fRbgY2zhb7GTWWOlpFmAxhClBDlIq8Rsubz1yQ==" - }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", diff --git a/starters/default/package.json b/starters/default/package.json index 5a6b703d9f0c1..ac4385564e084 100644 --- a/starters/default/package.json +++ b/starters/default/package.json @@ -10,14 +10,12 @@ "gatsby-plugin-image": "^2.19.0", "gatsby-plugin-manifest": "^4.19.0", "gatsby-plugin-offline": "^5.19.0", - "gatsby-plugin-react-helmet": "^5.19.0", "gatsby-plugin-sharp": "^4.19.0", "gatsby-source-filesystem": "^4.19.0", "gatsby-transformer-sharp": "^4.19.0", "prop-types": "^15.8.1", "react": "^18.1.0", - "react-dom": "^18.1.0", - "react-helmet": "^6.1.0" + "react-dom": "^18.1.0" }, "devDependencies": { "prettier": "^2.7.1" diff --git a/starters/default/src/components/seo.js b/starters/default/src/components/seo.js index d2dad201a9c28..b336df2076819 100644 --- a/starters/default/src/components/seo.js +++ b/starters/default/src/components/seo.js @@ -7,10 +7,9 @@ import * as React from "react" import PropTypes from "prop-types" -import { Helmet } from "react-helmet" import { useStaticQuery, graphql } from "gatsby" -function Seo({ description, lang, meta, title }) { +function Seo({ description, title, children }) { const { site } = useStaticQuery( graphql` query { @@ -29,60 +28,27 @@ function Seo({ description, lang, meta, title }) { const defaultTitle = site.siteMetadata?.title return ( - + <> + {defaultTitle ? `${title} | ${defaultTitle}` : title} + + + + + + + + + {children} + ) } Seo.defaultProps = { - lang: `en`, - meta: [], description: ``, } Seo.propTypes = { description: PropTypes.string, - lang: PropTypes.string, - meta: PropTypes.arrayOf(PropTypes.object), title: PropTypes.string.isRequired, } diff --git a/starters/default/src/pages/404.js b/starters/default/src/pages/404.js index b98b1ba58f303..bd7de997c1ba0 100644 --- a/starters/default/src/pages/404.js +++ b/starters/default/src/pages/404.js @@ -5,10 +5,11 @@ import Seo from "../components/seo" const NotFoundPage = () => ( -

    404: Not Found

    You just hit a route that doesn't exist... the sadness.

    ) +export const Head = () => + export default NotFoundPage diff --git a/starters/default/src/pages/index.js b/starters/default/src/pages/index.js index c02863ee9093f..707496b07ae97 100644 --- a/starters/default/src/pages/index.js +++ b/starters/default/src/pages/index.js @@ -119,4 +119,6 @@ const IndexPage = () => ( ) +export const Head = () => + export default IndexPage diff --git a/starters/default/src/pages/page-2.js b/starters/default/src/pages/page-2.js index 74b96e08c0ff8..aecc925549730 100644 --- a/starters/default/src/pages/page-2.js +++ b/starters/default/src/pages/page-2.js @@ -6,11 +6,12 @@ import Seo from "../components/seo" const SecondPage = () => ( -

    Hi from the second page

    Welcome to page 2

    Go back to the homepage
    ) +export const Head = () => + export default SecondPage diff --git a/starters/default/src/pages/using-ssr.js b/starters/default/src/pages/using-ssr.js index 6bbcff16eefd1..f89080d14662c 100644 --- a/starters/default/src/pages/using-ssr.js +++ b/starters/default/src/pages/using-ssr.js @@ -7,7 +7,6 @@ import Seo from "../components/seo" const UsingSSR = ({ serverData }) => { return ( -

    This page is rendered server-side

    @@ -33,6 +32,8 @@ const UsingSSR = ({ serverData }) => { ) } +export const Head = () => + export default UsingSSR export async function getServerData() { diff --git a/starters/default/src/pages/using-typescript.tsx b/starters/default/src/pages/using-typescript.tsx index 8018c1c905cbd..3f174786ca6a0 100644 --- a/starters/default/src/pages/using-typescript.tsx +++ b/starters/default/src/pages/using-typescript.tsx @@ -1,6 +1,6 @@ // If you don't want to use TypeScript you can delete this file! import * as React from "react" -import { PageProps, Link, graphql } from "gatsby" +import { PageProps, Link, graphql, HeadFC } from "gatsby" import Layout from "../components/layout" import Seo from "../components/seo" @@ -16,7 +16,6 @@ const UsingTypescript: React.FC> = ({ location, }) => ( -

    Gatsby supports TypeScript by default

    @@ -44,6 +43,8 @@ const UsingTypescript: React.FC> = ({
    ) +export const Head: HeadFC = () => + export default UsingTypescript export const query = graphql` diff --git a/starters/default/src/templates/using-dsg.js b/starters/default/src/templates/using-dsg.js index f2306afec4ddd..9a84c728815c9 100644 --- a/starters/default/src/templates/using-dsg.js +++ b/starters/default/src/templates/using-dsg.js @@ -6,7 +6,6 @@ import Seo from "../components/seo" const UsingDSG = () => ( -

    Hello from a DSG Page

    @@ -22,4 +21,6 @@ const UsingDSG = () => (
    ) +export const Head = () => + export default UsingDSG diff --git a/starters/gatsby-starter-wordpress-blog/gatsby-config.js b/starters/gatsby-starter-wordpress-blog/gatsby-config.js index 9f71aecf17353..bc7f644210eb1 100644 --- a/starters/gatsby-starter-wordpress-blog/gatsby-config.js +++ b/starters/gatsby-starter-wordpress-blog/gatsby-config.js @@ -54,9 +54,6 @@ module.exports = { }, }, - // See https://www.gatsbyjs.com/plugins/gatsby-plugin-react-helmet/?=gatsby-plugin-react-helmet - `gatsby-plugin-react-helmet`, - /** * this (optional) plugin enables Progressive Web App + Offline functionality * To learn more, visit: https://gatsby.dev/offline diff --git a/starters/gatsby-starter-wordpress-blog/gatsby-ssr.js b/starters/gatsby-starter-wordpress-blog/gatsby-ssr.js new file mode 100644 index 0000000000000..5500b627a86c4 --- /dev/null +++ b/starters/gatsby-starter-wordpress-blog/gatsby-ssr.js @@ -0,0 +1,9 @@ +/** + * Implement Gatsby's SSR (Server Side Rendering) APIs in this file. + * + * See: https://www.gatsbyjs.com/docs/ssr-apis/ + */ + +exports.onRenderBody = ({ setHtmlAttributes }) => { + setHtmlAttributes({ lang: `en` }) +} diff --git a/starters/gatsby-starter-wordpress-blog/package-lock.json b/starters/gatsby-starter-wordpress-blog/package-lock.json index 2b1cd439cb09b..cec99d30d67e6 100644 --- a/starters/gatsby-starter-wordpress-blog/package-lock.json +++ b/starters/gatsby-starter-wordpress-blog/package-lock.json @@ -10284,14 +10284,6 @@ "lodash": "^4.17.21" } }, - "gatsby-plugin-react-helmet": { - "version": "5.19.0", - "resolved": "https://registry.npmjs.org/gatsby-plugin-react-helmet/-/gatsby-plugin-react-helmet-5.19.0.tgz", - "integrity": "sha512-XXrJYfHqoaUe57oAF+/ljPHncrvYk0UonES3aUwynbWsR8UXhQpdbwqIOYZPGQgPsc1X55Kzdo+/3pU1gA9ajQ==", - "requires": { - "@babel/runtime": "^7.15.4" - } - }, "gatsby-plugin-sharp": { "version": "4.19.0", "resolved": "https://registry.npmjs.org/gatsby-plugin-sharp/-/gatsby-plugin-sharp-4.19.0.tgz", @@ -14713,22 +14705,6 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz", "integrity": "sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==" }, - "react-fast-compare": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-2.0.4.tgz", - "integrity": "sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw==" - }, - "react-helmet": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/react-helmet/-/react-helmet-5.2.1.tgz", - "integrity": "sha512-CnwD822LU8NDBnjCpZ4ySh8L6HYyngViTZLfBBb3NjtrpN8m49clH8hidHouq20I51Y6TpCTISCBbqiY5GamwA==", - "requires": { - "object-assign": "^4.1.1", - "prop-types": "^15.5.4", - "react-fast-compare": "^2.0.2", - "react-side-effect": "^1.1.0" - } - }, "react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", @@ -14767,14 +14743,6 @@ "resolved": "https://registry.npmjs.org/react-resize-aware/-/react-resize-aware-3.1.1.tgz", "integrity": "sha512-M8IyVLBN8D6tEUss+bxQlWte3ZYtNEGhg7rBxtCVG8yEBjUlZwUo5EFLq6tnvTZXcgAbCLjsQn+NCoTJKumRYg==" }, - "react-side-effect": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-1.2.0.tgz", - "integrity": "sha512-v1ht1aHg5k/thv56DRcjw+WtojuuDHFUgGfc+bFHOWsF4ZK6C2V57DO0Or0GPsg6+LSTE0M6Ry/gfzhzSwbc5w==", - "requires": { - "shallowequal": "^1.0.1" - } - }, "react-spring": { "version": "8.0.27", "resolved": "https://registry.npmjs.org/react-spring/-/react-spring-8.0.27.tgz", @@ -15465,11 +15433,6 @@ "resolved": "https://registry.npmjs.org/shallow-compare/-/shallow-compare-1.2.2.tgz", "integrity": "sha512-LUMFi+RppPlrHzbqmFnINTrazo0lPNwhcgzuAXVVcfy/mqPDrQmHAyz5bvV0gDAuRFrk804V0HpQ6u9sZ0tBeg==" }, - "shallowequal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz", - "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==" - }, "sharp": { "version": "0.30.7", "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.30.7.tgz", diff --git a/starters/gatsby-starter-wordpress-blog/package.json b/starters/gatsby-starter-wordpress-blog/package.json index 70b875b306511..f4e633257db44 100644 --- a/starters/gatsby-starter-wordpress-blog/package.json +++ b/starters/gatsby-starter-wordpress-blog/package.json @@ -14,7 +14,6 @@ "gatsby-plugin-image": "^2.19.0", "gatsby-plugin-manifest": "^4.19.0", "gatsby-plugin-offline": "^5.19.0", - "gatsby-plugin-react-helmet": "^5.19.0", "gatsby-plugin-sharp": "^4.19.0", "gatsby-source-wordpress": "^6.19.0", "gatsby-transformer-sharp": "^4.19.0", @@ -22,7 +21,6 @@ "lodash": "^4.17.21", "react": "^16.12.0", "react-dom": "^16.12.0", - "react-helmet": "^5.2.1", "typeface-merriweather": "0.0.72", "typeface-montserrat": "0.0.75" }, diff --git a/starters/gatsby-starter-wordpress-blog/src/components/seo.js b/starters/gatsby-starter-wordpress-blog/src/components/seo.js index 1a8798c5f25b6..457bad6c34ec5 100644 --- a/starters/gatsby-starter-wordpress-blog/src/components/seo.js +++ b/starters/gatsby-starter-wordpress-blog/src/components/seo.js @@ -7,10 +7,9 @@ import React from "react" import PropTypes from "prop-types" -import { Helmet } from "react-helmet" import { useStaticQuery, graphql } from "gatsby" -const SEO = ({ description, lang, meta, title }) => { +const SEO = ({ description, title, children }) => { const { wp, wpUser } = useStaticQuery( graphql` query { @@ -33,60 +32,27 @@ const SEO = ({ description, lang, meta, title }) => { const defaultTitle = wp.generalSettings?.title return ( - + <> + {defaultTitle ? `${title} | ${defaultTitle}` : title} + + + + + + + + + {children} + ) } SEO.defaultProps = { - lang: `en`, - meta: [], description: ``, } SEO.propTypes = { description: PropTypes.string, - lang: PropTypes.string, - meta: PropTypes.arrayOf(PropTypes.object), title: PropTypes.string.isRequired, } diff --git a/starters/gatsby-starter-wordpress-blog/src/pages/404.js b/starters/gatsby-starter-wordpress-blog/src/pages/404.js index 606eacb497e89..2db590a94c12b 100644 --- a/starters/gatsby-starter-wordpress-blog/src/pages/404.js +++ b/starters/gatsby-starter-wordpress-blog/src/pages/404.js @@ -9,13 +9,14 @@ const NotFoundPage = ({ data, location }) => { return ( -

    404: Not Found

    You just hit a route that doesn't exist... the sadness.

    ) } +const Head = () => + export default NotFoundPage export const pageQuery = graphql` diff --git a/starters/gatsby-starter-wordpress-blog/src/templates/Page.js b/starters/gatsby-starter-wordpress-blog/src/templates/Page.js index 9a92889661181..a8125bf91545b 100644 --- a/starters/gatsby-starter-wordpress-blog/src/templates/Page.js +++ b/starters/gatsby-starter-wordpress-blog/src/templates/Page.js @@ -19,8 +19,6 @@ const PageTemplate = ({ data: { previous, next, post } }) => { return ( - -
    { ) } +export const Head = ({ data: { post } }) => ( + +) + export default PageTemplate export const pageQuery = graphql` diff --git a/starters/gatsby-starter-wordpress-blog/src/templates/Post.js b/starters/gatsby-starter-wordpress-blog/src/templates/Post.js index f11b1ad28a5dc..3f926988ad65d 100644 --- a/starters/gatsby-starter-wordpress-blog/src/templates/Post.js +++ b/starters/gatsby-starter-wordpress-blog/src/templates/Post.js @@ -19,8 +19,6 @@ const BlogPostTemplate = ({ data: { previous, next, post } }) => { return ( - -
    { ) } +export const Head = ({ data: { post } }) => ( + +) + export default BlogPostTemplate export const pageQuery = graphql` diff --git a/starters/gatsby-starter-wordpress-blog/src/templates/blog-post-archive.js b/starters/gatsby-starter-wordpress-blog/src/templates/blog-post-archive.js index 42e5bcf217ced..d59cc66b9aa00 100644 --- a/starters/gatsby-starter-wordpress-blog/src/templates/blog-post-archive.js +++ b/starters/gatsby-starter-wordpress-blog/src/templates/blog-post-archive.js @@ -15,7 +15,6 @@ const BlogIndex = ({ if (!posts.length) { return ( -

    No blog posts found. Add posts to your WordPress site and they'll @@ -27,8 +26,6 @@ const BlogIndex = ({ return ( - -

      @@ -68,6 +65,8 @@ const BlogIndex = ({ ) } +export const Head = () => + export default BlogIndex export const pageQuery = graphql`