-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* π Remove link as the linked page is in draft * βοΈ Fix dead link * π Try to fix duplicate title bug I'm not sure if we added the SEO in wrapper for a reason back in August, didn't dare to delete it yet... * βοΈ Did work locally, but failed on CI. Case issue?
- Loading branch information
Showing
6 changed files
with
101 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/** | ||
* SEO component that queries for data with | ||
* Gatsby's useStaticQuery React hook | ||
* | ||
* See: https://www.gatsbyjs.org/docs/use-static-query/ | ||
*/ | ||
/* eslint import/no-default-export: off */ | ||
|
||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import { Helmet } from 'react-helmet-async' | ||
import { useStaticQuery, graphql } from 'gatsby' | ||
|
||
function SEO({ description, lang, meta, title }) { | ||
const { site } = useStaticQuery( | ||
graphql` | ||
query { | ||
site { | ||
siteMetadata { | ||
title | ||
description | ||
author | ||
image | ||
} | ||
} | ||
} | ||
`, | ||
) | ||
|
||
const metaDescription = description || site.siteMetadata.description | ||
|
||
return ( | ||
<Helmet | ||
htmlAttributes={{ | ||
lang, | ||
}} | ||
title={title} | ||
titleTemplate={`%s | ${site.siteMetadata.title}`} | ||
meta={[ | ||
{ | ||
name: `description`, | ||
content: metaDescription, | ||
}, | ||
{ | ||
property: `og:title`, | ||
content: title, | ||
}, | ||
{ | ||
property: `og:image`, | ||
content: site.siteMetadata.image, | ||
}, | ||
{ | ||
property: `og:title`, | ||
content: title, | ||
}, | ||
{ | ||
property: `og:description`, | ||
content: metaDescription, | ||
}, | ||
{ | ||
property: `og:type`, | ||
content: `website`, | ||
}, | ||
{ | ||
name: `twitter:creator`, | ||
content: site.siteMetadata.author, | ||
}, | ||
{ | ||
name: `twitter:title`, | ||
content: title, | ||
}, | ||
{ | ||
name: `twitter:description`, | ||
content: metaDescription, | ||
}, | ||
].concat(meta)} | ||
/> | ||
) | ||
} | ||
|
||
SEO.defaultProps = { | ||
lang: `en`, | ||
meta: [], | ||
description: ``, | ||
title: '', | ||
} | ||
|
||
SEO.propTypes = { | ||
description: PropTypes.string, | ||
lang: PropTypes.string, | ||
meta: PropTypes.arrayOf(PropTypes.object), | ||
title: PropTypes.string, | ||
} | ||
|
||
export default SEO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters