We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a3babb1 commit 9a1ce76Copy full SHA for 9a1ce76
lib/mdx/components.ts lib/mdx/components.tsxlib/mdx/components.ts renamed to lib/mdx/components.tsx
@@ -1,10 +1,19 @@
1
import Head from "next/head";
2
import { MDXComponents } from "mdx/types";
3
+import Link from "next/link";
4
+
5
+// To have client-side routing
6
+const CustomLink: MDXComponents["a"] = (props) => (
7
+ <Link href={props.href!}>
8
+ <a {...props} />
9
+ </Link>
10
+);
11
12
/**
13
* Use Next's components in MDX (e.g. Head)
14
*/
15
export const mdxComponents: MDXComponents = {
16
+ a: CustomLink,
17
// https://github.com/mdx-js/mdx/discussions/1921
18
head: Head as any,
19
};
0 commit comments