Skip to content

Commit 061109f

Browse files
committed
fix: correct markdown path detection for directories
- Use index.md for multi-segment paths and known directories - Fixes 404 errors for paths like /agent-wordlift/
1 parent f011e29 commit 061109f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/theme/DocBreadcrumbs/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,17 @@ function PageActionsDropdown(): ReactNode {
7474
return 'docs/introduction.md';
7575
}
7676

77-
// For paths that look like directories, try .md first, then /index.md
77+
// For paths that look like directories
7878
if (!mdPath.includes('.')) {
79-
// First try the direct .md file
80-
mdPath = `docs/${mdPath}.md`;
79+
// Check if it has multiple segments (likely a directory with index.md)
80+
const segments = mdPath.split('/');
81+
if (segments.length > 1 || segments[0] === 'agent-wordlift' || segments[0] === 'pages') {
82+
// For directories, use index.md
83+
mdPath = `docs/${mdPath}/index.md`;
84+
} else {
85+
// For single-level paths under pages/, try .md first
86+
mdPath = `docs/${mdPath}.md`;
87+
}
8188
}
8289

8390
return mdPath;

0 commit comments

Comments
 (0)