mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-13 05:07:03 +03:00
Send referrer for internal links [ci skip]
This commit is contained in:
parent
b94c34ec8f
commit
232a029de6
|
@ -8,6 +8,8 @@ import Icon from './icon'
|
||||||
import classes from '../styles/link.module.sass'
|
import classes from '../styles/link.module.sass'
|
||||||
import { isString } from './util'
|
import { isString } from './util'
|
||||||
|
|
||||||
|
const internalRegex = /(http(s?)):\/\/(prodi.gy|spacy.io|irl.spacy.io)/gi
|
||||||
|
|
||||||
const Whitespace = ({ children }) => (
|
const Whitespace = ({ children }) => (
|
||||||
// Ensure that links are always wrapped in spaces
|
// Ensure that links are always wrapped in spaces
|
||||||
<> {children} </>
|
<> {children} </>
|
||||||
|
@ -68,13 +70,15 @@ const Link = ({
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
const isInternal = internalRegex.test(dest)
|
||||||
|
const rel = isInternal ? null : 'noopener nofollow noreferrer'
|
||||||
return (
|
return (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<OutboundLink
|
<OutboundLink
|
||||||
href={dest}
|
href={dest}
|
||||||
className={linkClassNames}
|
className={linkClassNames}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener nofollow noreferrer"
|
rel={rel}
|
||||||
{...other}
|
{...other}
|
||||||
>
|
>
|
||||||
{content}
|
{content}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user