diff --git a/src/components/atoms/SEO.jsx b/src/components/atoms/SEO.jsx index 97be0d3..cfebeea 100644 --- a/src/components/atoms/SEO.jsx +++ b/src/components/atoms/SEO.jsx @@ -26,58 +26,72 @@ const query = graphql` } ` +const MetaTags = ({ title, description, url, image, meta }) => { + return ( + + + + {/* General tags */} + + + + + {/* OpenGraph tags */} + + + + + + {/* Twitter Card tags */} + + + + + + + ) +} + +MetaTags.propTypes = { + title: PropTypes.string, + description: PropTypes.string, + url: PropTypes.string, + image: PropTypes.string, + meta: PropTypes.object +} + export default class SEO extends PureComponent { static propTypes = { project: PropTypes.object } render() { - const { project } = this.props - return ( { + const { project } = this.props const meta = data.dataYaml - const title = (project && project.title) || meta.title const description = - project && project.fields.excerpt - ? project.fields.excerpt - : meta.description + (project && project.fields.excerpt) || meta.description const image = - project && project.img - ? project.img.childImageSharp.twitterImage.src - : meta.img.childImageSharp.resize.src - const url = - project && project.slug ? `${meta.url}${project.slug}` : meta.url + (project && project.img.childImageSharp.twitterImage.src) || + meta.img.childImageSharp.resize.src + const url = (project && `${meta.url}${project.slug}`) || meta.url return ( - - - - {/* General tags */} - - - - - {/* OpenGraph tags */} - - - - - - {/* Twitter Card tags */} - - - - - - + description={description} + url={url} + image={image} + meta={meta} + /> ) }} />