diff --git a/packages/docusaurus-theme-classic/src/theme/SiteMetadata/index.tsx b/packages/docusaurus-theme-classic/src/theme/SiteMetadata/index.tsx index 46c78fd4743a..052c0f40f45a 100644 --- a/packages/docusaurus-theme-classic/src/theme/SiteMetadata/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/SiteMetadata/index.tsx @@ -62,8 +62,7 @@ function useDefaultCanonicalUrl() { } = useDocusaurusContext(); const {pathname} = useLocation(); return ( - siteUrl + - useBaseUrl(pathname).replace(/\/+$/, trailingSlash ? '/' : '') + siteUrl + useBaseUrl(pathname).replace(/\/+$/, trailingSlash ? '/' : '') ); }