Skip to content

Commit ba6bca4

Browse files
committed
fix: route fragment links through Next Link
1 parent 7fb4c81 commit ba6bca4

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

src/components/MDX/Link.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
*/
1111

1212
import {Children, cloneElement} from 'react';
13-
import NextLink from 'next/link';
13+
import Link from 'next/link';
1414
import cn from 'classnames';
1515

1616
import {ExternalLink} from 'components/ExternalLink';
1717

18-
function Link({
18+
function MDXLink({
1919
href,
2020
className,
2121
children,
@@ -42,18 +42,13 @@ function Link({
4242
<ExternalLink href={href} className={cn(classes, className)} {...props}>
4343
{modifiedChildren}
4444
</ExternalLink>
45-
) : href.startsWith('#') ? (
46-
// eslint-disable-next-line jsx-a11y/anchor-has-content
47-
<a className={cn(classes, className)} href={href} {...props}>
48-
{modifiedChildren}
49-
</a>
5045
) : (
51-
<NextLink href={href} className={cn(classes, className)} {...props}>
46+
<Link href={href} className={cn(classes, className)} {...props}>
5247
{modifiedChildren}
53-
</NextLink>
48+
</Link>
5449
)}
5550
</>
5651
);
5752
}
5853

59-
export default Link;
54+
export default MDXLink;

0 commit comments

Comments
 (0)