We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eb2d1d0 commit ced77d5Copy full SHA for ced77d5
1 file changed
src/theme/Root.tsx
@@ -0,0 +1,23 @@
1
+import React, {type ReactNode} from 'react';
2
+import Head from '@docusaurus/Head';
3
+import {useLocation} from '@docusaurus/router';
4
+
5
+type RootProps = {
6
+ children: ReactNode;
7
+};
8
9
+const CANONICAL_BASE_URL = 'https://docs.nxtgrid.co';
10
11
+export default function Root({children}: RootProps): ReactNode {
12
+ const location = useLocation();
13
+ const canonicalUrl = `${CANONICAL_BASE_URL}${location.pathname}${location.search}`;
14
15
+ return (
16
+ <>
17
+ <Head>
18
+ <link rel="canonical" href={canonicalUrl} />
19
+ </Head>
20
+ {children}
21
+ </>
22
+ );
23
+}
0 commit comments