This is an automated email from the ASF dual-hosted git repository. jeffreyh pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/develop by this push: new cb95b7417d4 fix:Solve the problem of URL automatically carrying slashes causing dead links (#1366) cb95b7417d4 is described below commit cb95b7417d48acd05880de9eead628f9b50986e7 Author: yangon <2689991...@qq.com> AuthorDate: Fri Nov 15 15:02:37 2024 +0800 fix:Solve the problem of URL automatically carrying slashes causing dead links (#1366) Remove the slash from the URL.  --------- Co-authored-by: liyang <liy...@selectdb.com> --- src/theme/Layout/index.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/theme/Layout/index.tsx b/src/theme/Layout/index.tsx index 5dd6f43c3cd..66a06421cfa 100644 --- a/src/theme/Layout/index.tsx +++ b/src/theme/Layout/index.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import clsx from 'clsx'; import ErrorBoundary from '@docusaurus/ErrorBoundary'; import { PageMetadata, ThemeClassNames } from '@docusaurus/theme-common'; @@ -9,6 +9,7 @@ import ErrorPageContent from '@theme/ErrorPageContent'; import useScrollTop from '@site/src/hooks/scroll-top-hooks'; import './styles.scss'; import AnnouncementBar from '../AnnouncementBar'; +import { useHistory } from '@docusaurus/router'; // import Navbar from '@theme/Navbar'; // import Footer from '../Footer'; export default function CustomLayout(props) { @@ -23,8 +24,17 @@ export default function CustomLayout(props) { keywords, showAnnouncementBar, } = props; + const history = useHistory(); useKeyboardNavigation(); const { isTop } = useScrollTop(80); + + useEffect(() => { + if ( + history.location.pathname?.length > 1 && + history.location.pathname[history.location.pathname.length - 1] === '/' + ) + history.replace(history.location.pathname.slice(0, -1)); + }, []); return ( <Layout> <PageMetadata title={title} description={description} keywords={keywords} /> --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org