Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-plugin-wpgraphql-seo

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-plugin-wpgraphql-seo - npm Package Compare versions

Comparing version 0.1.2 to 1.0.1

100

dist/gatsby-plugin-wpgraphql-seo.cjs.development.js

@@ -11,6 +11,24 @@ 'use strict';

function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
var SEOContext = /*#__PURE__*/React.createContext({});
var SEO = function SEO(_ref) {
var _global$schema, _schema$logo, _schema$logo$localFil, _schema$logo$localFil2, _schema$logo2, _schema$logo2$localFi, _schema$logo2$localFi2, _schema$logo3, _schema$logo3$localFi, _schema$logo3$localFi2, _ref3, _seo$schema, _seo$schema2;
var _global$schema;

@@ -22,3 +40,3 @@ var _ref$post = _ref.post,

title = _ref.title,
uri = _ref.uri;
postSchema = _ref.postSchema;
var seo = post.seo;

@@ -72,76 +90,2 @@

var metaDescription = (seo == null ? void 0 : seo.metaDesc) ? seo.metaDesc : '';
var pageUrl = (seo == null ? void 0 : seo.canonical) || "" + (schema == null ? void 0 : schema.siteUrl) + ((post == null ? void 0 : post.uri) || uri); // const logo = schema.logo && schema.logo.localFile.childImageSharp.fixed;
var sameAs = social ? Object.entries(social).map(function (_ref2) {
var account = _ref2[0],
_ref2$ = _ref2[1],
url = _ref2$.url,
username = _ref2$.username;
if (username || url) {
return username && account === 'twitter' ? "https://www.twitter.com/" + username : url;
}
return null;
}).filter(function (acc) {
return !!acc;
}) : [];
var logo = (schema == null ? void 0 : schema.logo) ? {
'@type': 'ImageObject',
'@id': schema.siteUrl + "/#" + (schema.companyOrPerson === 'person' ? 'personlogo' : 'logo'),
inLanguage: inLanguage,
url: "" + schema.siteUrl + ((_schema$logo = schema.logo) == null ? void 0 : (_schema$logo$localFil = _schema$logo.localFile) == null ? void 0 : (_schema$logo$localFil2 = _schema$logo$localFil.childImageSharp) == null ? void 0 : _schema$logo$localFil2.fixed.src),
width: (_schema$logo2 = schema.logo) == null ? void 0 : (_schema$logo2$localFi = _schema$logo2.localFile) == null ? void 0 : (_schema$logo2$localFi2 = _schema$logo2$localFi.childImageSharp) == null ? void 0 : _schema$logo2$localFi2.fixed.width,
height: (_schema$logo3 = schema.logo) == null ? void 0 : (_schema$logo3$localFi = _schema$logo3.localFile) == null ? void 0 : (_schema$logo3$localFi2 = _schema$logo3$localFi.childImageSharp) == null ? void 0 : _schema$logo3$localFi2.fixed.height,
caption: schema.logo.altText
} : null;
var image = (schema == null ? void 0 : schema.logo) ? {
'@id': schema.siteUrl + "/#" + (schema.companyOrPerson === 'person' ? 'personlogo' : 'logo')
} : null;
var orgSchema = schema ? (_ref3 = {
'@type': schema.companyOrPerson === 'person' ? ['Person', 'Organization'] : 'Organization',
'@id': schema.siteUrl + "/#" + (schema.companyOrPerson === 'person' ? '/schema/person' : 'organization'),
name: schema.siteName,
url: schema.siteUrl,
sameAs: sameAs
}, _ref3[schema.companyOrPerson === 'person' ? 'image' : 'logo'] = logo, _ref3[schema.companyOrPerson === 'person' ? 'logo' : 'image'] = image, _ref3) : null;
var websiteSchema = schema ? {
'@type': (seo == null ? void 0 : (_seo$schema = seo.schema) == null ? void 0 : _seo$schema.articleType) && seo.schema.articleType.length >= 1 ? seo.schema.articleType : 'WebSite',
'@id': schema.siteUrl + "/#website",
url: schema.siteUrl,
name: metaTitle,
description: metaDescription,
publisher: {
'@id': schema.siteUrl + "/#organization"
},
inLanguage: inLanguage
} : {};
var pageSchema = (post == null ? void 0 : post.seo) && schema ? {
'@type': (seo == null ? void 0 : (_seo$schema2 = seo.schema) == null ? void 0 : _seo$schema2.pageType) ? seo.schema.pageType : ['WebPage'],
'@id': pageUrl + "#webpage",
url: "" + pageUrl,
name: seo.title,
isPartOf: {
'@id': (schema == null ? void 0 : schema.siteUrl) + "/#website"
},
description: seo == null ? void 0 : seo.description,
inLanguage: inLanguage,
potentialAction: [{
'@type': 'ReadAction',
target: [pageUrl]
}]
} : {};
if (pageSchema && (post == null ? void 0 : post.date)) {
pageSchema.datePublished = post.date;
}
if (pageSchema && (post == null ? void 0 : post.modified)) {
pageSchema.dateModified = post.modified;
}
var schemaObj = {
'@context': 'https://schema.org',
'@graph': [orgSchema, websiteSchema, pageSchema]
};
return React__default.createElement(reactHelmet.Helmet, {

@@ -189,5 +133,5 @@ htmlAttributes: {

encodeSpecialCharacters: false
}, React__default.createElement("script", {
}, postSchema && React__default.createElement("script", {
type: "application/ld+json"
}, JSON.stringify(schemaObj, null, 2)));
}, JSON.stringify(_extends({}, postSchema), null, 2)));
};

@@ -194,0 +138,0 @@

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,i=require("react-helmet"),o=t.createContext({}),l=function(e){var l,r,a,s,c,p,u,d,m,g,v,y,h,f=e.post,w=void 0===f?{}:f,b=e.meta,x=void 0===b?[]:b,O=e.title,P=e.uri,T=w.seo,U=t.useContext(o).global,S=null==U||null==(l=U.schema)?void 0:l.inLanguage,V=null==U?void 0:U.schema,j=null==U?void 0:U.webmaster,_=null==U?void 0:U.social,z=[];(null==j?void 0:j.baiduVerify)&&z.push({name:"baidu-site-verification",content:j.baiduVerify}),(null==j?void 0:j.googleVerify)&&z.push({name:"google-site-verification",content:j.googleVerify}),(null==j?void 0:j.msVerify)&&z.push({name:"msvalidate.01",content:j.msVerify}),(null==j?void 0:j.yandexVerify)&&z.push({name:"yandex-verification",content:j.yandexVerify}),(null==_?void 0:_.pinterest)&&_.pinterest.metaTag&&z.push({name:"p:domain_verify",content:_.pinterest.metaTag});var A=O||T.title,C=(null==T?void 0:T.metaDesc)?T.metaDesc:"",D=(null==T?void 0:T.canonical)||""+(null==V?void 0:V.siteUrl)+((null==w?void 0:w.uri)||P),I=_?Object.entries(_).map((function(e){var t=e[1],n=t.url,i=t.username;return i||n?i&&"twitter"===e[0]?"https://www.twitter.com/"+i:n:null})).filter((function(e){return!!e})):[],L=(null==V?void 0:V.logo)?{"@type":"ImageObject","@id":V.siteUrl+"/#"+("person"===V.companyOrPerson?"personlogo":"logo"),inLanguage:S,url:""+V.siteUrl+(null==(r=V.logo)||null==(a=r.localFile)||null==(s=a.childImageSharp)?void 0:s.fixed.src),width:null==(c=V.logo)||null==(p=c.localFile)||null==(u=p.childImageSharp)?void 0:u.fixed.width,height:null==(d=V.logo)||null==(m=d.localFile)||null==(g=m.childImageSharp)?void 0:g.fixed.height,caption:V.logo.altText}:null,E=(null==V?void 0:V.logo)?{"@id":V.siteUrl+"/#"+("person"===V.companyOrPerson?"personlogo":"logo")}:null,F=V?((v={"@type":"person"===V.companyOrPerson?["Person","Organization"]:"Organization","@id":V.siteUrl+"/#"+("person"===V.companyOrPerson?"/schema/person":"organization"),name:V.siteName,url:V.siteUrl,sameAs:I})["person"===V.companyOrPerson?"image":"logo"]=L,v["person"===V.companyOrPerson?"logo":"image"]=E,v):null,N=V?{"@type":(null==T||null==(y=T.schema)?void 0:y.articleType)&&T.schema.articleType.length>=1?T.schema.articleType:"WebSite","@id":V.siteUrl+"/#website",url:V.siteUrl,name:A,description:C,publisher:{"@id":V.siteUrl+"/#organization"},inLanguage:S}:{},q=(null==w?void 0:w.seo)&&V?{"@type":(null==T||null==(h=T.schema)?void 0:h.pageType)?T.schema.pageType:["WebPage"],"@id":D+"#webpage",url:""+D,name:T.title,isPartOf:{"@id":(null==V?void 0:V.siteUrl)+"/#website"},description:null==T?void 0:T.description,inLanguage:S,potentialAction:[{"@type":"ReadAction",target:[D]}]}:{};q&&(null==w?void 0:w.date)&&(q.datePublished=w.date),q&&(null==w?void 0:w.modified)&&(q.dateModified=w.modified);var M={"@context":"https://schema.org","@graph":[F,N,q]};return n.createElement(i.Helmet,{htmlAttributes:{lang:S},title:A,meta:[{name:"robots",content:"max-snippet:-1, max-image-preview:large, max-video-preview:-1"},{name:"description",content:C},{property:"og:site_name",content:null==V?void 0:V.companyName},{property:"og:title",content:(null==T?void 0:T.opengraphTitle)||A},{property:"og:description",content:null==T?void 0:T.opengraphDescription},{property:"og:locale",content:"en_GB"},{property:"og:type",content:"website"},{name:"twitter:card",content:null==_?void 0:_.twitter.cardType},{name:"twitter:creator",content:null==_?void 0:_.twitter.username},{name:"twitter:title",content:(null==T?void 0:T.twitterTitle)||A},{name:"twitter:description",content:(null==T?void 0:T.twitterDescription)||C}].filter((function(e){return!!e.content})).concat(x,z),encodeSpecialCharacters:!1},n.createElement("script",{type:"application/ld+json"},JSON.stringify(M,null,2)))};exports.SEOContext=o,exports.Seo=l,exports.default=l;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,i=require("react-helmet");function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}var r=t.createContext({}),a=function(e){var a,l=e.post,c=e.meta,p=void 0===c?[]:c,s=e.title,u=e.postSchema,d=(void 0===l?{}:l).seo,m=t.useContext(r).global,v=null==m||null==(a=m.schema)?void 0:a.inLanguage,y=null==m?void 0:m.schema,f=null==m?void 0:m.webmaster,g=null==m?void 0:m.social,h=[];(null==f?void 0:f.baiduVerify)&&h.push({name:"baidu-site-verification",content:f.baiduVerify}),(null==f?void 0:f.googleVerify)&&h.push({name:"google-site-verification",content:f.googleVerify}),(null==f?void 0:f.msVerify)&&h.push({name:"msvalidate.01",content:f.msVerify}),(null==f?void 0:f.yandexVerify)&&h.push({name:"yandex-verification",content:f.yandexVerify}),(null==g?void 0:g.pinterest)&&g.pinterest.metaTag&&h.push({name:"p:domain_verify",content:g.pinterest.metaTag});var w=s||d.title,x=(null==d?void 0:d.metaDesc)?d.metaDesc:"";return n.createElement(i.Helmet,{htmlAttributes:{lang:v},title:w,meta:[{name:"robots",content:"max-snippet:-1, max-image-preview:large, max-video-preview:-1"},{name:"description",content:x},{property:"og:site_name",content:null==y?void 0:y.companyName},{property:"og:title",content:(null==d?void 0:d.opengraphTitle)||w},{property:"og:description",content:null==d?void 0:d.opengraphDescription},{property:"og:locale",content:"en_GB"},{property:"og:type",content:"website"},{name:"twitter:card",content:null==g?void 0:g.twitter.cardType},{name:"twitter:creator",content:null==g?void 0:g.twitter.username},{name:"twitter:title",content:(null==d?void 0:d.twitterTitle)||w},{name:"twitter:description",content:(null==d?void 0:d.twitterDescription)||x}].filter((function(e){return!!e.content})).concat(p,h),encodeSpecialCharacters:!1},u&&n.createElement("script",{type:"application/ld+json"},JSON.stringify(o({},u),null,2)))};exports.SEOContext=r,exports.Seo=a,exports.default=a;
//# sourceMappingURL=gatsby-plugin-wpgraphql-seo.cjs.production.min.js.map
import React, { createContext, useContext } from 'react';
import { Helmet } from 'react-helmet';
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
var SEOContext = /*#__PURE__*/createContext({});
var SEO = function SEO(_ref) {
var _global$schema, _schema$logo, _schema$logo$localFil, _schema$logo$localFil2, _schema$logo2, _schema$logo2$localFi, _schema$logo2$localFi2, _schema$logo3, _schema$logo3$localFi, _schema$logo3$localFi2, _ref3, _seo$schema, _seo$schema2;
var _global$schema;

@@ -14,3 +32,3 @@ var _ref$post = _ref.post,

title = _ref.title,
uri = _ref.uri;
postSchema = _ref.postSchema;
var seo = post.seo;

@@ -64,76 +82,2 @@

var metaDescription = (seo == null ? void 0 : seo.metaDesc) ? seo.metaDesc : '';
var pageUrl = (seo == null ? void 0 : seo.canonical) || "" + (schema == null ? void 0 : schema.siteUrl) + ((post == null ? void 0 : post.uri) || uri); // const logo = schema.logo && schema.logo.localFile.childImageSharp.fixed;
var sameAs = social ? Object.entries(social).map(function (_ref2) {
var account = _ref2[0],
_ref2$ = _ref2[1],
url = _ref2$.url,
username = _ref2$.username;
if (username || url) {
return username && account === 'twitter' ? "https://www.twitter.com/" + username : url;
}
return null;
}).filter(function (acc) {
return !!acc;
}) : [];
var logo = (schema == null ? void 0 : schema.logo) ? {
'@type': 'ImageObject',
'@id': schema.siteUrl + "/#" + (schema.companyOrPerson === 'person' ? 'personlogo' : 'logo'),
inLanguage: inLanguage,
url: "" + schema.siteUrl + ((_schema$logo = schema.logo) == null ? void 0 : (_schema$logo$localFil = _schema$logo.localFile) == null ? void 0 : (_schema$logo$localFil2 = _schema$logo$localFil.childImageSharp) == null ? void 0 : _schema$logo$localFil2.fixed.src),
width: (_schema$logo2 = schema.logo) == null ? void 0 : (_schema$logo2$localFi = _schema$logo2.localFile) == null ? void 0 : (_schema$logo2$localFi2 = _schema$logo2$localFi.childImageSharp) == null ? void 0 : _schema$logo2$localFi2.fixed.width,
height: (_schema$logo3 = schema.logo) == null ? void 0 : (_schema$logo3$localFi = _schema$logo3.localFile) == null ? void 0 : (_schema$logo3$localFi2 = _schema$logo3$localFi.childImageSharp) == null ? void 0 : _schema$logo3$localFi2.fixed.height,
caption: schema.logo.altText
} : null;
var image = (schema == null ? void 0 : schema.logo) ? {
'@id': schema.siteUrl + "/#" + (schema.companyOrPerson === 'person' ? 'personlogo' : 'logo')
} : null;
var orgSchema = schema ? (_ref3 = {
'@type': schema.companyOrPerson === 'person' ? ['Person', 'Organization'] : 'Organization',
'@id': schema.siteUrl + "/#" + (schema.companyOrPerson === 'person' ? '/schema/person' : 'organization'),
name: schema.siteName,
url: schema.siteUrl,
sameAs: sameAs
}, _ref3[schema.companyOrPerson === 'person' ? 'image' : 'logo'] = logo, _ref3[schema.companyOrPerson === 'person' ? 'logo' : 'image'] = image, _ref3) : null;
var websiteSchema = schema ? {
'@type': (seo == null ? void 0 : (_seo$schema = seo.schema) == null ? void 0 : _seo$schema.articleType) && seo.schema.articleType.length >= 1 ? seo.schema.articleType : 'WebSite',
'@id': schema.siteUrl + "/#website",
url: schema.siteUrl,
name: metaTitle,
description: metaDescription,
publisher: {
'@id': schema.siteUrl + "/#organization"
},
inLanguage: inLanguage
} : {};
var pageSchema = (post == null ? void 0 : post.seo) && schema ? {
'@type': (seo == null ? void 0 : (_seo$schema2 = seo.schema) == null ? void 0 : _seo$schema2.pageType) ? seo.schema.pageType : ['WebPage'],
'@id': pageUrl + "#webpage",
url: "" + pageUrl,
name: seo.title,
isPartOf: {
'@id': (schema == null ? void 0 : schema.siteUrl) + "/#website"
},
description: seo == null ? void 0 : seo.description,
inLanguage: inLanguage,
potentialAction: [{
'@type': 'ReadAction',
target: [pageUrl]
}]
} : {};
if (pageSchema && (post == null ? void 0 : post.date)) {
pageSchema.datePublished = post.date;
}
if (pageSchema && (post == null ? void 0 : post.modified)) {
pageSchema.dateModified = post.modified;
}
var schemaObj = {
'@context': 'https://schema.org',
'@graph': [orgSchema, websiteSchema, pageSchema]
};
return React.createElement(Helmet, {

@@ -181,5 +125,5 @@ htmlAttributes: {

encodeSpecialCharacters: false
}, React.createElement("script", {
}, postSchema && React.createElement("script", {
type: "application/ld+json"
}, JSON.stringify(schemaObj, null, 2)));
}, JSON.stringify(_extends({}, postSchema), null, 2)));
};

@@ -186,0 +130,0 @@

@@ -6,5 +6,26 @@ import { FC } from 'react';

post?: any;
uri?: null;
postSchema?: IPageSchema;
}
interface IPageSchema {
'@context': string;
'@graph': IPageSchemaItems[];
}
interface IPageSchemaItems {
'@type': any;
'@id': string;
url: string;
name: any;
isPartOf: {
'@id': string;
};
description: any;
inLanguage: String;
potentialAction: {
'@type': string;
target: string[];
}[];
datePublished?: string;
dateModified?: string;
}
declare const SEO: FC<SeoProps>;
export default SEO;
{
"version": "0.1.2",
"version": "1.0.1",
"license": "MIT",

@@ -32,3 +32,3 @@ "main": "dist/index.js",

"author": "Ash Hitchcock",
"description": "A SEO component that brings data from Yoast in your Gatsby App vi WpGraphQl.",
"description": "A SEO component that brings data from Yoast in your Gatsby App with WpGraphQl.",
"module": "dist/gatsby-plugin-wpgraphql-seo.esm.js",

@@ -35,0 +35,0 @@ "publishConfig": {

# Gatsby SEO For WpGraphQL and Yoast
> Details coming soon...
Works with:
(https://github.com/ashhitch/wp-graphql-yoast-seo)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc