mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 10:17:55 +02:00
refactor(v2): make external links more secure (#2783)
This commit is contained in:
parent
70c201c24d
commit
7448501c7c
2 changed files with 3 additions and 2 deletions
|
@ -85,8 +85,9 @@ function Link({isNavLink, ...props}: Props) {
|
|||
return !targetLink || !isInternal || targetLink.startsWith('#') ? (
|
||||
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
||||
<a
|
||||
{...(isInternal ? props : {target: '_blank', ...props})}
|
||||
href={targetLink}
|
||||
{...(!isInternal && {target: '_blank', rel: 'noopener noreferrer'})}
|
||||
{...props}
|
||||
/>
|
||||
) : (
|
||||
<LinkComponent
|
||||
|
|
|
@ -73,7 +73,7 @@ const Page = () => (
|
|||
Check out my <Link to="/blog">blog</Link>!
|
||||
</p>
|
||||
<p>
|
||||
{/* Note that external links still use `a` tags. */}
|
||||
{/* Note that external links still use `a` tags, but automatically opens in new tab. */}
|
||||
Follow me on <a href="https://twitter.com/docusaurus">Twitter</a>!
|
||||
</p>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue