Skip to content

Commit b2c2cc7

Browse files
committed
feat: conditionally render DocPageLinks based on route
1 parent 4f468ab commit b2c2cc7

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,6 @@
7070
"last 1 firefox version",
7171
"last 1 safari version"
7272
]
73-
}
73+
},
74+
"packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad"
7475
}

src/theme/TOCItems/index.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import TOCItemsOriginal from '@theme-original/TOCItems'
33
import type TOCItemsType from '@theme/TOCItems'
44
import type { WrapperProps } from '@docusaurus/types'
55
import { useDoc } from '@docusaurus/plugin-content-docs/client'
6+
import { useLocation } from '@docusaurus/router'
67
import Translate from '@docusaurus/Translate'
78
import styles from './styles.module.css'
89

@@ -75,12 +76,17 @@ class DocPageLinksErrorBoundary extends React.Component<
7576
}
7677

7778
export default function TOCItemsWrapper(props: Props): ReactNode {
79+
const { pathname } = useLocation()
80+
const isDocsRoute = /^\/(en\/)?(docs|agents|ecosystem|integration)(\/|$)/.test(pathname)
81+
7882
return (
7983
<>
8084
<TOCItemsOriginal {...props} />
81-
<DocPageLinksErrorBoundary>
82-
<DocPageLinks />
83-
</DocPageLinksErrorBoundary>
85+
{isDocsRoute && (
86+
<DocPageLinksErrorBoundary>
87+
<DocPageLinks />
88+
</DocPageLinksErrorBoundary>
89+
)}
8490
</>
8591
)
8692
}

0 commit comments

Comments
 (0)