From c5db9741469c579766c9d7130b1d43f7ec007b68 Mon Sep 17 00:00:00 2001 From: John Knox Date: Thu, 21 May 2020 11:31:24 +0100 Subject: [PATCH] feat: open external links in new tab by default 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 8d7fb6408cdb..7db5334d7aad 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 - + ) : (