From 85bd8bf1cbc5b6baec0450011cbe01174063308e Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 10 May 2019 14:26:03 +0200 Subject: [PATCH] prevent search engine indexing except for live --- src/components/Seo.jsx | 17 +++++++++++++---- src/pages/404.jsx | 2 +- src/pages/index.jsx | 2 +- src/templates/Doc.jsx | 1 + src/templates/Swagger/index.jsx | 1 + src/templates/Typedoc/index.jsx | 1 + 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/components/Seo.jsx b/src/components/Seo.jsx index 883468f8..aecc194e 100644 --- a/src/components/Seo.jsx +++ b/src/components/Seo.jsx @@ -73,7 +73,8 @@ const MetaTags = ({ image, schema, siteMeta, - article + article, + location }) => ( + + {/* Prevent search engine indexing except for live */} + {location.hostname !== 'docs.oceanprotocol.com' && ( + + )} ) @@ -114,10 +120,11 @@ MetaTags.propTypes = { image: PropTypes.string, schema: PropTypes.string, siteMeta: PropTypes.object, - article: PropTypes.bool + article: PropTypes.bool, + location: PropTypes.object.isRequired } -const SEO = ({ title, description, slug, article }) => ( +const SEO = ({ title, description, slug, article, location }) => ( { @@ -149,6 +156,7 @@ const SEO = ({ title, description, slug, article }) => ( schema={schema} siteMeta={siteMeta} article={article} + location={location} /> ) }} @@ -159,7 +167,8 @@ SEO.propTypes = { title: PropTypes.string, description: PropTypes.string, slug: PropTypes.string, - article: PropTypes.bool + article: PropTypes.bool, + location: PropTypes.object.isRequired } export default SEO diff --git a/src/pages/404.jsx b/src/pages/404.jsx index 77c36fd8..e8f6d3d3 100755 --- a/src/pages/404.jsx +++ b/src/pages/404.jsx @@ -45,7 +45,7 @@ export default class NotFoundPage extends Component { render() { return ( <> - +
diff --git a/src/pages/index.jsx b/src/pages/index.jsx index b6c88b4d..de2a6d3a 100755 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -55,7 +55,7 @@ SectionLink.propTypes = { const IndexPage = ({ data, location }) => ( <> - + }> diff --git a/src/templates/Doc.jsx b/src/templates/Doc.jsx index d92cde7e..9e0310eb 100644 --- a/src/templates/Doc.jsx +++ b/src/templates/Doc.jsx @@ -70,6 +70,7 @@ export default class DocTemplate extends Component { description={description} slug={slug} article + location={location} /> diff --git a/src/templates/Swagger/index.jsx b/src/templates/Swagger/index.jsx index 0845dbd0..75e50327 100644 --- a/src/templates/Swagger/index.jsx +++ b/src/templates/Swagger/index.jsx @@ -84,6 +84,7 @@ export default class ApiSwaggerTemplate extends Component { description={description} slug={pageContext.slug} article + location={location} /> diff --git a/src/templates/Typedoc/index.jsx b/src/templates/Typedoc/index.jsx index a696578f..3399c02a 100644 --- a/src/templates/Typedoc/index.jsx +++ b/src/templates/Typedoc/index.jsx @@ -52,6 +52,7 @@ export default class TypedocTemplate extends Component { description={description} slug={pageContext.slug} article + location={location} />