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, image,
schema, schema,
siteMeta, siteMeta,
article article,
location
}) => ( }) => (
<Helmet <Helmet
defaultTitle={siteMeta.siteTitle} defaultTitle={siteMeta.siteTitle}
@ -104,6 +105,11 @@ const MetaTags = ({
<meta name="twitter:title" content={title} /> <meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} /> <meta name="twitter:description" content={description} />
<meta name="twitter:image" content={image} /> <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> </Helmet>
) )
@ -114,10 +120,11 @@ MetaTags.propTypes = {
image: PropTypes.string, image: PropTypes.string,
schema: PropTypes.string, schema: PropTypes.string,
siteMeta: PropTypes.object, 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 <StaticQuery
query={query} query={query}
render={data => { render={data => {
@ -149,6 +156,7 @@ const SEO = ({ title, description, slug, article }) => (
schema={schema} schema={schema}
siteMeta={siteMeta} siteMeta={siteMeta}
article={article} article={article}
location={location}
/> />
) )
}} }}
@ -159,7 +167,8 @@ SEO.propTypes = {
title: PropTypes.string, title: PropTypes.string,
description: PropTypes.string, description: PropTypes.string,
slug: PropTypes.string, slug: PropTypes.string,
article: PropTypes.bool article: PropTypes.bool,
location: PropTypes.object.isRequired
} }
export default SEO export default SEO

View File

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

View File

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

View File

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

View File

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

View File

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