From 70c201c24dcf3acc338704cd71c54b21bdc0b77e Mon Sep 17 00:00:00 2001 From: John Knox Date: Thu, 21 May 2020 12:34:33 +0100 Subject: [PATCH] feat(v2): open external links in new tab by default (#2780) Docusaurus is already opinionated about doing this, for example the navbar and footer do this already. This changes the Link component to do the same. This includes links in markdown in the form of `[label](url)`. You can override this behaviour by passing the target: '_self' prop. --- packages/docusaurus/src/client/exports/Link.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/docusaurus/src/client/exports/Link.tsx b/packages/docusaurus/src/client/exports/Link.tsx index 8d7fb6408c..7db5334d7a 100644 --- a/packages/docusaurus/src/client/exports/Link.tsx +++ b/packages/docusaurus/src/client/exports/Link.tsx @@ -84,7 +84,10 @@ function Link({isNavLink, ...props}: Props) { return !targetLink || !isInternal || targetLink.startsWith('#') ? ( // eslint-disable-next-line jsx-a11y/anchor-has-content - + ) : (