gatsby-plugin-wpgraphql-seo
Advanced tools
Comparing version 1.0.5 to 1.1.0
@@ -96,2 +96,4 @@ 'use strict'; | ||
var metaDescription = (seo == null ? void 0 : seo.metaDesc) ? seo.metaDesc : ''; | ||
var robotsIndex = seo.metaRobotsNoindex ? 'noindex' : 'index'; | ||
var robotsFollow = seo.metaRobotsNofollow ? 'nofollow' : 'follow'; | ||
return React__default.createElement(reactHelmet.Helmet, { | ||
@@ -104,3 +106,3 @@ htmlAttributes: { | ||
name: "robots", | ||
content: "max-snippet:-1, max-image-preview:large, max-video-preview:-1" | ||
content: "max-snippet:-1, max-image-preview:large, max-video-preview:-1, " + robotsIndex + ", " + robotsFollow | ||
}, { | ||
@@ -107,0 +109,0 @@ name: "description", |
@@ -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");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,c,p=e.post,s=e.meta,u=void 0===s?[]:s,d=e.title,m=e.postSchema,v=(void 0===p?{}:p).seo;m?c=m:v&&(null==v||null==(a=v.schema)?void 0:a.raw)&&(c=JSON.parse(v.schema.raw));var y=t.useContext(r).global,f=null==y||null==(l=y.schema)?void 0:l.inLanguage,g=null==y?void 0:y.schema,h=null==y?void 0:y.webmaster,w=null==y?void 0:y.social,x=[];(null==h?void 0:h.baiduVerify)&&x.push({name:"baidu-site-verification",content:h.baiduVerify}),(null==h?void 0:h.googleVerify)&&x.push({name:"google-site-verification",content:h.googleVerify}),(null==h?void 0:h.msVerify)&&x.push({name:"msvalidate.01",content:h.msVerify}),(null==h?void 0:h.yandexVerify)&&x.push({name:"yandex-verification",content:h.yandexVerify}),(null==w?void 0:w.pinterest)&&w.pinterest.metaTag&&x.push({name:"p:domain_verify",content:w.pinterest.metaTag});var b=d||v.title,V=(null==v?void 0:v.metaDesc)?v.metaDesc:"";return n.createElement(i.Helmet,{htmlAttributes:{lang:f},title:b,meta:[{name:"robots",content:"max-snippet:-1, max-image-preview:large, max-video-preview:-1"},{name:"description",content:V},{property:"og:site_name",content:null==g?void 0:g.companyName},{property:"og:title",content:(null==v?void 0:v.opengraphTitle)||b},{property:"og:description",content:null==v?void 0:v.opengraphDescription},{property:"og:locale",content:"en_GB"},{property:"og:type",content:"website"},{name:"twitter:card",content:null==w?void 0:w.twitter.cardType},{name:"twitter:creator",content:null==w?void 0:w.twitter.username},{name:"twitter:title",content:(null==v?void 0:v.twitterTitle)||b},{name:"twitter:description",content:(null==v?void 0:v.twitterDescription)||V}].filter((function(e){return!!e.content})).concat(u,x),encodeSpecialCharacters:!1},c&&n.createElement("script",{type:"application/ld+json"},JSON.stringify(o({},c),null,2)))};exports.SEOContext=r,exports.Seo=a,exports.default=a; | ||
"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,o=require("react-helmet");function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}var r=t.createContext({}),a=function(e){var a,l,c,p=e.post,s=e.meta,u=void 0===s?[]:s,d=e.title,m=e.postSchema,v=(void 0===p?{}:p).seo;m?c=m:v&&(null==v||null==(a=v.schema)?void 0:a.raw)&&(c=JSON.parse(v.schema.raw));var f=t.useContext(r).global,y=null==f||null==(l=f.schema)?void 0:l.inLanguage,g=null==f?void 0:f.schema,h=null==f?void 0:f.webmaster,w=null==f?void 0:f.social,x=[];(null==h?void 0:h.baiduVerify)&&x.push({name:"baidu-site-verification",content:h.baiduVerify}),(null==h?void 0:h.googleVerify)&&x.push({name:"google-site-verification",content:h.googleVerify}),(null==h?void 0:h.msVerify)&&x.push({name:"msvalidate.01",content:h.msVerify}),(null==h?void 0:h.yandexVerify)&&x.push({name:"yandex-verification",content:h.yandexVerify}),(null==w?void 0:w.pinterest)&&w.pinterest.metaTag&&x.push({name:"p:domain_verify",content:w.pinterest.metaTag});var b=d||v.title,V=(null==v?void 0:v.metaDesc)?v.metaDesc:"";return n.createElement(o.Helmet,{htmlAttributes:{lang:y},title:b,meta:[{name:"robots",content:"max-snippet:-1, max-image-preview:large, max-video-preview:-1, "+(v.metaRobotsNoindex?"noindex":"index")+", "+(v.metaRobotsNofollow?"nofollow":"follow")},{name:"description",content:V},{property:"og:site_name",content:null==g?void 0:g.companyName},{property:"og:title",content:(null==v?void 0:v.opengraphTitle)||b},{property:"og:description",content:null==v?void 0:v.opengraphDescription},{property:"og:locale",content:"en_GB"},{property:"og:type",content:"website"},{name:"twitter:card",content:null==w?void 0:w.twitter.cardType},{name:"twitter:creator",content:null==w?void 0:w.twitter.username},{name:"twitter:title",content:(null==v?void 0:v.twitterTitle)||b},{name:"twitter:description",content:(null==v?void 0:v.twitterDescription)||V}].filter((function(e){return!!e.content})).concat(u,x),encodeSpecialCharacters:!1},c&&n.createElement("script",{type:"application/ld+json"},JSON.stringify(i({},c),null,2)))};exports.SEOContext=r,exports.Seo=a,exports.default=a; | ||
//# sourceMappingURL=gatsby-plugin-wpgraphql-seo.cjs.production.min.js.map |
@@ -89,2 +89,4 @@ import React, { createContext, useContext } from 'react'; | ||
var metaDescription = (seo == null ? void 0 : seo.metaDesc) ? seo.metaDesc : ''; | ||
var robotsIndex = seo.metaRobotsNoindex ? 'noindex' : 'index'; | ||
var robotsFollow = seo.metaRobotsNofollow ? 'nofollow' : 'follow'; | ||
return React.createElement(Helmet, { | ||
@@ -97,3 +99,3 @@ htmlAttributes: { | ||
name: "robots", | ||
content: "max-snippet:-1, max-image-preview:large, max-video-preview:-1" | ||
content: "max-snippet:-1, max-image-preview:large, max-video-preview:-1, " + robotsIndex + ", " + robotsFollow | ||
}, { | ||
@@ -100,0 +102,0 @@ name: "description", |
{ | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
@@ -175,2 +175,48 @@ # Gatsby SEO For WpGraphQL and Yoast | ||
For archive pages | ||
```jsx | ||
import React from 'react'; | ||
import { graphql } from 'gatsby'; | ||
import Seo from 'gatsby-plugin-wpgraphql-seo'; | ||
const Blog = ({ data }) => { | ||
return ( | ||
<> | ||
<Seo | ||
title="Blog Title" | ||
postSchema={JSON.parse(data.wp.contentTypes.post.schema.raw)} | ||
/> | ||
<p>Rest of page</p> | ||
</> | ||
); | ||
}; | ||
export default Blog; | ||
export const pageQuery = graphql` | ||
query GET_POSTS($ids: [String]) { | ||
wp { | ||
seo { | ||
contentTypes { | ||
post { | ||
schema { | ||
raw | ||
} | ||
} | ||
} | ||
} | ||
} | ||
allWpPost(filter: { id: { in: $ids } }) { | ||
nodes { | ||
... | ||
} | ||
} | ||
} | ||
`; | ||
``` | ||
Additional props are provided for overrides and simpler pages: | ||
@@ -187,2 +233,25 @@ | ||
... More docs and info coming soon | ||
### Removing search action from schema. | ||
By default Yoast adds a search action to the schema if you want remove it you can add the following PHP to your functions.php file: | ||
```php | ||
<?php | ||
add_filter('wpseo_schema_website', 'XX_remove_schema_search'); | ||
function XX_remove_schema_search($data) | ||
{ | ||
if ($data['potentialAction']) { | ||
foreach ($data['potentialAction'] as $key => $value) { | ||
if ($value['@type'] && $value['@type'] == 'SearchAction') { | ||
unset($data['potentialAction'][$key]); | ||
} | ||
} | ||
} | ||
return $data; | ||
} | ||
``` | ||
... More docs coming soon |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52611
373
256