1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-06-28 00:27:40 +02:00

prevent search engines on unallowed hosts

This commit is contained in:
Matthias Kretschmann 2018-12-09 15:14:31 +01:00
parent d97fa8bb2e
commit 639127af9e
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 19 additions and 11 deletions

View File

@ -1,11 +1,8 @@
import React, { PureComponent } from 'react'
import Helmet from 'react-helmet'
import styles from './HostnameCheck.module.scss'
const allowedHosts = [
'matthiaskretschmann.com',
'beta.matthiaskretschmann.com',
'localhost'
]
const allowedHosts = ['matthiaskretschmann.com', 'beta.matthiaskretschmann.com']
export default class HostnameInfo extends PureComponent {
checkAllowedHost = () => {
@ -15,6 +12,7 @@ export default class HostnameInfo extends PureComponent {
}
state = {
// default to true so SSR builds never show the banner
isAllowedHost: true
}
@ -24,16 +22,19 @@ export default class HostnameInfo extends PureComponent {
}
render() {
// return nothing if we're on an allowed host
if (this.state.isAllowedHost) return null
return (
<>
<Helmet>
<meta name="robots" content="noindex,nofollow" />
</Helmet>
<aside className={styles.hostnameInfo}>
Hi there 👋. Please note that only the code and documentation of this
site are MIT licensed. But my logo and the combination of typography,
colors, and layout making up my brand identity are not. Likewise, if
you know how to remove this banner you also should be able to remove
my Typekit code and Analytics code from your published site.
<p>{`Hi there 👋. Please note that only the code and documentation of this
site are open source. But my logo and the combination of typography,
colors, and layout making up my brand identity are not. Don't just
clone, do a remix.`}</p>
</aside>
</>
)

View File

@ -4,7 +4,7 @@
position: sticky;
top: 0;
z-index: 99;
padding: $spacer / 2 $spacer;
padding: $spacer / 3;
font-size: $font-size-small;
font-weight: bold;
background: rgba($brand-light, .8);
@ -12,4 +12,11 @@
:global(.dark) & {
background: rgba($body-background-color--dark, .8);
}
p {
margin: auto;
margin-bottom: 0;
max-width: $screen-lg;
text-align: center;
}
}