Skip to content

Commit 4235089

Browse files
committed
fix sidebar issue and ensure that the navTitle is used for directories with an index file
1 parent 1fc4849 commit 4235089

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/lib/navigation.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ async function buildTreeNavigation(entry: EntryType): Promise<TreeItem | null> {
3737
return null
3838
}
3939
if (isDirectory(entry)) {
40+
const file = await getFileContent(entry)
41+
let frontmatter = null
42+
if (file) {
43+
frontmatter = await file.getExportValue("frontmatter")
44+
}
4045
return {
41-
title: entry.getTitle(),
46+
title: frontmatter?.navTitle ?? entry.getTitle(),
4247
path: `/docs${entry.getPath()}`,
4348
isFile: isFile(entry),
4449
slug: entry.getPathSegments(),

0 commit comments

Comments
 (0)