mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 05:57:05 +02:00
fix(core): links with target "_blank" should no be checked by the broken link checker (#9788)
This commit is contained in:
parent
cce1698c60
commit
2f2ed41829
2 changed files with 37 additions and 1 deletions
|
@ -143,8 +143,13 @@ function Link(
|
|||
// It is simple local anchor link targeting current page?
|
||||
const isAnchorLink = targetLink?.startsWith('#') ?? false;
|
||||
|
||||
// See also RR logic:
|
||||
// https://github.com/remix-run/react-router/blob/v5/packages/react-router-dom/modules/Link.js#L47
|
||||
const hasInternalTarget = !props.target || props.target === '_self';
|
||||
|
||||
// Should we use a regular <a> tag instead of React-Router Link component?
|
||||
const isRegularHtmlLink = !targetLink || !isInternal || isAnchorLink;
|
||||
const isRegularHtmlLink =
|
||||
!targetLink || !isInternal || !hasInternalTarget || isAnchorLink;
|
||||
|
||||
if (!noBrokenLinkCheck && (isAnchorLink || !isRegularHtmlLink)) {
|
||||
brokenLinks.collectLink(targetLink!);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue