UNPKG

@pittica/gatsby-plugin-seo

Version:
76 lines (61 loc) 1.92 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); exports.__esModule = true; exports.default = Organization; var _react = _interopRequireDefault(require("react")); var _reactHelmetAsync = require("react-helmet-async"); var _propTypes = _interopRequireDefault(require("prop-types")); var _gatsbyPluginUtils = require("@pittica/gatsby-plugin-utils"); function Organization({ organization: { name, url, logo }, socials: { facebook, instagram, twitter, linkedin, github, youtube } }) { const sameAs = []; if (facebook && facebook.show) { sameAs.push((0, _gatsbyPluginUtils.withUrl)(facebook.page, "https://www.facebook.com/")); } if (instagram && instagram.show) { sameAs.push((0, _gatsbyPluginUtils.withUrl)(instagram.username, "https://instagram.com/")); } if (twitter && twitter.show) { sameAs.push((0, _gatsbyPluginUtils.withUrl)(twitter.username, "https://twitter.com/")); } if (linkedin && linkedin.show) { sameAs.push((0, _gatsbyPluginUtils.withUrl)(linkedin.page, "https://www.linkedin.com/company/")); } if (github && github.show) { sameAs.push((0, _gatsbyPluginUtils.withUrl)(github.username, "https://github.com/")); } if (youtube && youtube.show) { sameAs.push((0, _gatsbyPluginUtils.withUrl)(youtube.username, "https://www.youtube.com/user/")); } return /*#__PURE__*/_react.default.createElement(_reactHelmetAsync.Helmet, null, /*#__PURE__*/_react.default.createElement("script", { type: "application/ld+json", key: "ld-json-organization" }, JSON.stringify({ "@context": "http://schema.org", "@type": "Organization", url, name, logo: { url: logo, "@type": "ImageObject" }, sameAs }))); } Organization.propTypes = { organization: _propTypes.default.object, socials: _propTypes.default.object };