Skip to content

Commit d529996

Browse files
committed
fix(surround): remove all posible dupplicate paths
1 parent 59c69bc commit d529996

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/runtime/internal/surround.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ export async function generateItemSurround<T extends PageCollectionItemBase>(que
1717
] as ContentNavigationItem[]
1818
}
1919

20-
function flattedData(data: ContentNavigationItem[]) {
20+
export function flattedData(data: ContentNavigationItem[]) {
2121
const flatData = data.flatMap((item) => {
2222
const children: ContentNavigationItem[] = item.children ? flattedData(item.children) : []
23-
if (item.page === false || (children.length && children[0].path === item.path)) {
23+
if (item.page === false || (children.length && children.find(c => c.path === item.path))) {
2424
return children
2525
}
2626

0 commit comments

Comments
 (0)