/** * SEO component that queries for data with * Gatsby's useStaticQuery React hook * * See: https://www.gatsbyjs.com/docs/how-to/querying-data/use-static-query/ */ import * as React from "react" import { useStaticQuery, graphql } from "gatsby" const Seo = ({ description, title, children }) => { const { site } = useStaticQuery( graphql` query { site { siteMetadata { title description social { twitter } } } } ` ) const metaDescription = description || site.siteMetadata.description const defaultTitle = site.siteMetadata?.title return ( <> {defaultTitle ? `${title} | ${defaultTitle}` : title} {children} ) } export default Seo