diff --git a/src/components/MDX/Link.tsx b/src/components/MDX/Link.tsx index 7bf041e56..a42d52891 100644 --- a/src/components/MDX/Link.tsx +++ b/src/components/MDX/Link.tsx @@ -29,6 +29,16 @@ function Link({ // eslint-disable-next-line jsx-a11y/anchor-has-content return ; } + + // Tweak external links (added by ja.react.dev team) + href = href + .replace( + 'https://developer.mozilla.org/en-US/', + 'https://developer.mozilla.org/' + ) + .replace('https://reactjs.org/', 'https://ja.reactjs.org/') + .replace('https://legacy.reactjs.org/', 'https://ja.legacy.reactjs.org/'); + return ( <> {href.startsWith('https://') ? (