Skip to content

Commit 986da22

Browse files
authored
Merge pull request #2379 from Lwiel/RDoc-3785
RDoc-3785 Fix canonical URLs
2 parents f66744e + c49bbf8 commit 986da22

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

src/theme/DocItem/Metadata/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,10 @@ export default function MetadataWrapper(props: Props): ReactNode {
2828

2929
// Strip trailing slash from base URL to avoid double slashes
3030
const baseUrl = (siteConfig.url as string).replace(/\/$/, "");
31-
let canonicalUrl = isDocumentationPage
31+
const canonicalUrl = isDocumentationPage
3232
? `${baseUrl}/${siteConfig.customFields.latestVersion}${metadata.slug}`
3333
: `${baseUrl}${permalink}`;
3434

35-
if (!canonicalUrl.endsWith("/")) {
36-
canonicalUrl = canonicalUrl.concat("/");
37-
}
38-
3935
const isHomepage = metadata.slug === "/";
4036
const description = metadata.description || frontMatter.description || "";
4137
const title = metadata.title || "";

0 commit comments

Comments
 (0)