MCPcopy Create free account
hub / github.com/IABTechLab/uid2docs / SiteMetadataWrapper

Function SiteMetadataWrapper

src/theme/SiteMetadata/index.tsx:11–30  ·  view source on GitHub ↗
(props: Props)

Source from the content-addressed store, hash-verified

9type Props = WrapperProps<typeof SiteMetadataType>;
10
11export default function SiteMetadataWrapper(props: Props): JSX.Element {
12 const location = useLocation();
13 const { siteConfig } = useDocusaurusContext();
14
15 let canonical = new URL(location.pathname, siteConfig.url).href;
16 // sidebar.js generates alternate pages that end in -1, -2, .etc
17 // this canonical href fix will prevent search engines from indexing those pages as unique and instead dedupe
18 if (canonical.substring(canonical.length - 2).match(/-[0-9]/)) {
19 canonical = canonical.substring(0, canonical.length - 2);
20 }
21
22 return (
23 <>
24 <SiteMetadata {...props} />
25 <Head>
26 <link rel="canonical" href={canonical}></link>
27 </Head>
28 </>
29 );
30}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected