(props: Props)
| 9 | type Props = WrapperProps<typeof SiteMetadataType>; |
| 10 | |
| 11 | export 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected