Skip to content

Commit d874d9c

Browse files
committed
try to fix bug
1 parent 9267fc0 commit d874d9c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

docs/advanced/routing.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ tags: [routing, docusaurus, react-router, docs, pages, blog]
66
---
77

88
```mdx-code-block
9-
import Link from '@docusaurus/Link';
109
import {useActiveDocContext} from '@docusaurus/plugin-content-docs/client';
1110
import {useLocation} from '@docusaurus/router';
1211
import BrowserOnly from '@docusaurus/BrowserOnly';
@@ -101,14 +100,14 @@ For example:
101100
This allows seamless version switching while preserving sidebar state.
102101

103102
```mdx-code-block
104-
export const URLPath = () => <code>{useLocation().pathname}</code>;
105-
export const FilePath = () => {
103+
export const URLPath = () => <BrowserOnly>{()=><code>{useLocation().pathname}</code>}</BrowserOnly>
104+
export const FilePath = () => <BrowserOnly>{() => {
106105
const currentVersion = useActiveDocContext('default').activeVersion.name;
107106
return <code>{currentVersion === 'current' ? './docs/' : `./versioned_docs/version-${currentVersion}/`}advanced/routing.md</code>;
108-
};
107+
}}</BrowserOnly>
109108
```
110109

111-
This page, <BrowserOnly>{()=> <URLPath /> }</BrowserOnly>, is generated from <BrowserOnly>{()=> <FilePath />}</BrowserOnly>. The doc content is displayed inside `@theme/DocPage`, which manages layout, sidebar, and navigation.
110+
This page, <URLPath />, is generated from <FilePath />. The doc content is displayed inside `@theme/DocPage`, which manages layout, sidebar, and navigation.
112111

113112
---
114113

0 commit comments

Comments
 (0)