diff --git a/src/config/sidebar.ts b/src/config/sidebar.ts index 0dee02c..d9cf8e9 100644 --- a/src/config/sidebar.ts +++ b/src/config/sidebar.ts @@ -39,15 +39,18 @@ export function createFilesystemSidebar( ): Item[] { const folder = path.join(process.cwd(), route); + const collator = new Intl.Collator(undefined, { numeric: true }); + const resolvedOptions: Required = { filter: (item) => { - return item.matterData?.excludeFromSidebar !== true; + return ( + item.matterData?.excludeFromSidebar !== true && + !path.parse(item.filePath).name.startsWith("(_)") + ); }, sort: (a, b) => { if (stripExtension(a.filePath).endsWith("index")) return -1; - if (a.filePath > b.filePath) return 1; - if (b.filePath > a.filePath) return -1; - return 0; + return collator.compare(a.filePath, b.filePath); }, transform: (item) => item, ...options,