mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-22 18:43:29 +00:00
Fix href being empty in TOC (#3269)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
fix href being empty in TOC
|
||||
@@ -17,7 +17,11 @@ export async function PageDocumentItem(props: {
|
||||
context: GitBookSiteContext;
|
||||
}) {
|
||||
const { rootPages, page, context } = props;
|
||||
const href = context.linker.toPathForPage({ pages: rootPages, page });
|
||||
let href = context.linker.toPathForPage({ pages: rootPages, page });
|
||||
// toPathForPage can returns an empty path, this will cause all links to point to the current page.
|
||||
if (href === '') {
|
||||
href = '/';
|
||||
}
|
||||
|
||||
return (
|
||||
<li className="flex flex-col">
|
||||
|
||||
Reference in New Issue
Block a user