diff --git a/server/pages-helpers.ts b/server/pages-helpers.ts index 2d78a4f2d6..5fc4c27e10 100644 --- a/server/pages-helpers.ts +++ b/server/pages-helpers.ts @@ -101,8 +101,9 @@ const categoryPagePathForDir = (fs, dirPath) => { const innerExists = fs.existsSync(innerCategoryPage); if (outerExists && innerExists) { - // Docusaurus only accepts a category page within its associated directory. - return innerCategoryPage; + throw new Error( + `cannot generate the docs navigation sidebar due to an ambiguous category page: remove ${outerCategoryPage} and keep ${innerCategoryPage}` + ); } if (outerExists) { throw new Error( diff --git a/uvu-tests/config-docs.test.ts b/uvu-tests/config-docs.test.ts index 7ebd2f3fd4..1df6710424 100644 --- a/uvu-tests/config-docs.test.ts +++ b/uvu-tests/config-docs.test.ts @@ -370,61 +370,6 @@ title: Get Started with DB RBAC assert.equal(actual, expected); }); -Suite( - "allows category pages in the same directory as the associated subdirectory", - () => { - const files = { - "/docs/pages/database-access/guides.mdx": `--- -title: Database Access Guides ----`, - "/docs/pages/database-access/guides/postgres.mdx": `--- -title: Postgres Guide ----`, - "/docs/pages/database-access/guides/mysql.mdx": `--- -title: MySQL Guide ----`, - "/docs/pages/database-access/guides/rbac.mdx": `--- -title: Database Access RBAC ----`, - "/docs/pages/database-access/guides/rbac/get-started.mdx": `--- -title: Get Started with DB RBAC ----`, - }; - - const expected = [ - { - title: "Database Access Guides", - slug: "/database-access/guides/", - entries: [ - { - title: "Database Access RBAC", - slug: "/database-access/guides/rbac/", - entries: [ - { - title: "Get Started with DB RBAC", - slug: "/database-access/guides/rbac/get-started/", - }, - ], - }, - { - title: "MySQL Guide", - slug: "/database-access/guides/mysql/", - }, - { - title: "Postgres Guide", - slug: "/database-access/guides/postgres/", - }, - ], - }, - ]; - - const vol = Volume.fromJSON(files); - const fs = createFsFromVolume(vol); - let actual = generateNavPaths(fs, "/docs/pages/database-access"); - assert.equal(actual, expected); - } -); - Suite("generates four levels of the sidebar", () => { const files = { "/docs/pages/database-access/guides/guides.mdx": `---