Skip to content

Commit 1aec8b7

Browse files
authored
Remove trailing slashes in path (#34)
* Remove trailing slashes in path * Remove trailing slashes in path
1 parent b175082 commit 1aec8b7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/theme/DocItem/Content/index.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import React from 'react';
22
import Content from '@theme-original/DocItem/Content';
3-
import { useLocation } from '@docusaurus/router';
3+
import { Redirect, useLocation } from '@docusaurus/router';
44

55
export default function DocItemContent(props) {
66
const { pathname } = useLocation();
77
const isLegacyDoc =
88
pathname.startsWith('/legacy-policies/') && pathname !== '/legacy-policies/';
99

10+
if (pathname.length > 1 && pathname.endsWith('/')) {
11+
return <Redirect to={pathname.slice(0, -1)}/>
12+
}
13+
1014
return (
1115
<>
1216
{isLegacyDoc && (

0 commit comments

Comments
 (0)