From 468110e2ff8393d2d134a621c96c7ae3d01dd60d Mon Sep 17 00:00:00 2001 From: SonMooSans Date: Tue, 26 Dec 2023 19:45:13 +0800 Subject: [PATCH] Docs: Fix category index page --- apps/docs/app/docs/[mode]/[[...slug]]/page.tsx | 4 +++- packages/headless/src/source/page-tree-builder.ts | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/docs/app/docs/[mode]/[[...slug]]/page.tsx b/apps/docs/app/docs/[mode]/[[...slug]]/page.tsx index 0a026ac34..96e6f2595 100644 --- a/apps/docs/app/docs/[mode]/[[...slug]]/page.tsx +++ b/apps/docs/app/docs/[mode]/[[...slug]]/page.tsx @@ -78,7 +78,9 @@ export default async function Page({ function Category({ page }: { page: Page }): JSX.Element { const filtered = utils.files.filter( (docs) => - docs.info.dirname === page.info.dirname && docs.info.name !== 'index', + docs.type === 'page' && + docs.info.dirname === page.info.dirname && + docs.info.name !== 'index', ) as Page[]; return ( diff --git a/packages/headless/src/source/page-tree-builder.ts b/packages/headless/src/source/page-tree-builder.ts index 62c760c03..f8262e1aa 100644 --- a/packages/headless/src/source/page-tree-builder.ts +++ b/packages/headless/src/source/page-tree-builder.ts @@ -198,11 +198,11 @@ function build(ctx: PageTreeBuilderContext): PageTree.PageTree { } export function createPageTreeBuilder({ - storage: graph, + storage, resolveIcon = () => undefined, }: CreatePageTreeBuilderOptions): PageTreeBuilder { const context: PageTreeBuilderContext = { - storage: graph, + storage, resolveIcon(icon) { if (!icon) return; return resolveIcon(icon);