1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

prevent search engine indexing except for live

This commit is contained in:
Matthias Kretschmann 2019-05-10 14:26:03 +02:00
parent 385639549e
commit 85bd8bf1cb
Signed by: m
GPG Key ID: 606EEEF3C479A91F
6 changed files with 18 additions and 6 deletions

View File

@ -73,7 +73,8 @@ const MetaTags = ({
image,
schema,
siteMeta,
article
article,
location
}) => (
<Helmet
defaultTitle={siteMeta.siteTitle}
@ -104,6 +105,11 @@ const MetaTags = ({
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} />
<meta name="twitter:image" content={image} />
{/* Prevent search engine indexing except for live */}
{location.hostname !== 'docs.oceanprotocol.com' && (
<meta name="robots" content="noindex,nofollow" />
)}
</Helmet>
)
@ -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 }) => (
<StaticQuery
query={query}
render={data => {
@ -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

View File

@ -45,7 +45,7 @@ export default class NotFoundPage extends Component {
render() {
return (
<>
<SEO title="404 - Not Found" />
<SEO location={this.props.location} title="404 - Not Found" />
<Layout location={this.props.location}>
<Content>
<article className={styles.content}>

View File

@ -55,7 +55,7 @@ SectionLink.propTypes = {
const IndexPage = ({ data, location }) => (
<>
<SEO />
<SEO location={location} />
<Layout location={location} header={<HeaderHome />}>
<Content>

View File

@ -70,6 +70,7 @@ export default class DocTemplate extends Component {
description={description}
slug={slug}
article
location={location}
/>
<Layout location={location}>

View File

@ -84,6 +84,7 @@ export default class ApiSwaggerTemplate extends Component {
description={description}
slug={pageContext.slug}
article
location={location}
/>
<Layout location={location}>

View File

@ -52,6 +52,7 @@ export default class TypedocTemplate extends Component {
description={description}
slug={pageContext.slug}
article
location={location}
/>
<Layout location={location}>