text: import { useStaticQuery, graphql } from "gatsby";
  import PropTypes from "prop-types";
  import React from "react";
  import Helmet from "react-helmet";
  import favicon from "../images/home.png";
  
  function SEO({ description, lang, meta, keywords, title, image, options }) {
    const { site } = useStaticQuery(graphql`
      query DefaultSEOQuery {
        site {
          siteMetadata {
            title
            description
            author
            url
          }
        }
      }
    `);
  
    let url_checking = "";
  
    options != undefined
      ? options.internal_image == true
        ? (url_checking = site.siteMetadata.url)
        : (url_checking = "")
      : (url_checking = "");
  
    const metaDescription = description || site.siteMetadata.description;
    const metaImage =
      url_checking + image || site.siteMetadata.url + favicon;
  
    return (
      <Helmet
        htmlAttributes={{
          lang,
        }}
        meta={[
          {
            name: `description`,
            content: metaDescription,
          },
          {
            property: `og:title`,
            content: title,
          },
          {
            property: `og:description`,
            content: metaDescription,
          },
          {
            property: `og:type`,
            content: `website`,
          },
          {
            property: `og:image`,
            content: metaImage,
          },
          {
            property: `twitter:image`,
            content: metaImage,
          },
          {
            property: `image`,
            content: metaImage,
          },
          {
            name: `twitter:card`,
            content: `summary`,
          },
          {
            name: `twitter:creator`,
            content: site.siteMetadata.author,
          },
          {
            name: `twitter:title`,
            content: title,
          },
          {
            name: `twitter:description`,
            content: metaDescription,
          },
        ]
          .concat(
            keywords.length > 0
              ? {
                  name: `keywords`,
                  content: keywords.join(`, `),
                }
              : []
          )
          .concat(meta)}
        title={title}
        titleTemplate={`%s`}
      />
    );
  }
  
  SEO.defaultProps = {
    lang: `en`,
    keywords: [],
    meta: [],
    image: undefined,
  };
  
  SEO.propTypes = {
    description: PropTypes.string,
    keywords: PropTypes.arrayOf(PropTypes.string),
    lang: PropTypes.string,
    meta: PropTypes.array,
    title: PropTypes.string.isRequired,
    image: PropTypes.string,
    options: PropTypes.object,
  };
  
  export default SEO;
  