docs: mention Link can be used for external links (#5212)

This commit is contained in:
Sébastien Lorber 2021-07-23 12:24:03 +02:00 committed by GitHub
parent 7b2d45a439
commit b38c35a36d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,6 +60,8 @@ This component enables linking to internal pages as well as a powerful performan
The component is a wrapper around react-routers `<Link>` component that adds useful enhancements specific to Docusaurus. All props are passed through to react-routers `<Link>` component. The component is a wrapper around react-routers `<Link>` component that adds useful enhancements specific to Docusaurus. All props are passed through to react-routers `<Link>` component.
External links also work, and automatically have these props: `target="_blank" rel="noopener noreferrer"`.
```jsx {2,7} ```jsx {2,7}
import React from 'react'; import React from 'react';
import Link from '@docusaurus/Link'; import Link from '@docusaurus/Link';
@ -70,8 +72,7 @@ const Page = () => (
Check out my <Link to="/blog">blog</Link>! Check out my <Link to="/blog">blog</Link>!
</p> </p>
<p> <p>
{/* Note that external links still use `a` tags, but automatically opens in new tab. */} Follow me on <Link to="https://twitter.com/docusaurus">Twitter</Link>!
Follow me on <a href="https://twitter.com/docusaurus">Twitter</a>!
</p> </p>
</div> </div>
); );