diff --git a/src/components/DevDocTemplate/index.tsx b/src/components/DevDocTemplate/index.tsx index be6ea8441..ad9f331ca 100644 --- a/src/components/DevDocTemplate/index.tsx +++ b/src/components/DevDocTemplate/index.tsx @@ -251,6 +251,10 @@ const DevDocTemplate: FC = (props) => { } url.searchParams.set('pageid', e.data.params.pageid); + const hash = e.data.subsection; + if (hash) { + url.hash = hash; + } window.history.replaceState({}, '', url.toString()); } } diff --git a/src/components/VersionIframe/index.tsx b/src/components/VersionIframe/index.tsx index fa818aaae..e6e23eaa3 100644 --- a/src/components/VersionIframe/index.tsx +++ b/src/components/VersionIframe/index.tsx @@ -34,11 +34,14 @@ const VersionIframe: React.FC = ({ } else if (mainUrlParams.has('pageId')) { url.searchParams.set('pageid', mainUrlParams.get('pageId')); } + if (location?.hash) { + url.hash = location?.hash; + } url.searchParams.set('_iframe', '1'); } return url.toString(); - }, [iframeUrl, isDarkMode, location?.search]); + }, [iframeUrl, isDarkMode, location?.search, location?.hash]); return (