2021-08-04 19:17:51 +00:00
|
|
|
import React from "react"
|
2021-08-08 20:11:43 +00:00
|
|
|
import { useStaticQuery, graphql } from "gatsby"
|
2021-08-04 19:17:51 +00:00
|
|
|
import PropTypes from "prop-types"
|
|
|
|
import { Helmet } from "react-helmet"
|
|
|
|
|
|
|
|
function Seo(props) {
|
|
|
|
const { site } = useStaticQuery(
|
|
|
|
graphql`
|
|
|
|
query {
|
|
|
|
site {
|
|
|
|
siteMetadata {
|
|
|
|
title
|
|
|
|
description
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
)
|
|
|
|
|
|
|
|
const defaultDesc = props.description || site.siteMetadata.description
|
|
|
|
const defaultTitle = site.siteMetadata?.title
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Helmet
|
|
|
|
title={props.title || defaultTitle}
|
|
|
|
meta={[
|
|
|
|
{
|
|
|
|
name: "description",
|
|
|
|
content: defaultDesc,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
property: "og:title",
|
|
|
|
content: props.title || defaultTitle,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
property: "og:description",
|
|
|
|
content: defaultDesc,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
property: "og:type",
|
|
|
|
content: "website",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
property: "theme-color",
|
|
|
|
content: props.embedColor
|
|
|
|
}
|
|
|
|
].concat(props.meta)}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
Seo.defaultProps = {
|
|
|
|
lang: "en",
|
|
|
|
meta: [],
|
2021-08-07 10:33:58 +00:00
|
|
|
embedColor: "#9517cf"
|
2021-08-04 19:17:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Seo.propTypes = {
|
|
|
|
description: PropTypes.string,
|
|
|
|
lang: PropTypes.string,
|
|
|
|
meta: PropTypes.arrayOf(PropTypes.object),
|
|
|
|
title: PropTypes.string,
|
|
|
|
embedColor: PropTypes.string
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Seo
|