Skip to content

Commit

Permalink
Merge pull request #426 from shuding/shu/b622
Browse files Browse the repository at this point in the history
Fix bugs when a folder is empty
  • Loading branch information
shuding committed Mar 24, 2022
2 parents 500920d + 93980a7 commit a1e4f67
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/nextra-theme-docs/src/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function Menu({ directories, anchors }: MenuProps) {
return (
<ul>
{directories.map(item => {
if (item.children) {
if (item.children && (item.children.length || !item.withIndexPage)) {
return <Folder key={item.name} item={item} anchors={anchors} />
}
return <File key={item.name} item={item} anchors={anchors} />
Expand Down
2 changes: 2 additions & 0 deletions packages/nextra-theme-docs/src/utils/normalize-pages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ export default function normalizePages({
pageItem.firstChildRoute =
normalizedChildren.flatDirectories[0].route
topLevelPageItems.push(pageItem)
} else if (pageItem.withIndexPage) {
topLevelPageItems.push(pageItem)
}

break
Expand Down

0 comments on commit a1e4f67

Please sign in to comment.