From 4b5cb283c7631d476cbf08cbf4eb6084b52c3820 Mon Sep 17 00:00:00 2001 From: Paul Gottschling Date: Tue, 19 Nov 2024 09:21:38 -0500 Subject: [PATCH] Fix path checking logic (#503) `categoryPagePathForDir` considers a page called `introduction.mdx` the same as the root of the containing directory. This is incorrect, and this equivalence actually depends on whether a redirect exists between the `introduction` page and the directory root. --- server/config-docs.ts | 8 ++------ uvu-tests/config-docs.test.ts | 5 ----- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/server/config-docs.ts b/server/config-docs.ts index 5c917c7422..f2b4a99013 100644 --- a/server/config-docs.ts +++ b/server/config-docs.ts @@ -253,17 +253,13 @@ const correspondingFileExistsForURL = ( // Each URL in the docs config begins at docs/pages within a given version's // content directory. Get the MDX file for a given URL and check if it // exists in the filesystem. URL paths must point to (a) an MDX file with - // the same name as the final path segment; (b) a file named "index.mdx"; or - // (c) a file named "introduction.mdx". + // the same name as the final path segment; or (b) a file named "index.mdx". const mdxPath = urlpath.replace(/\/$/, ".mdx"); const docsPagePath = resolve(join(dirRoot, mdxPath)); - const indexPath = resolve(join(dirRoot, urlpath + "index.mdx")); - const introPath = resolve(join(dirRoot, urlpath + "introduction.mdx")); - if ( - [docsPagePath, indexPath, introPath].find((p) => { + [docsPagePath, indexPath].find((p) => { return fs.existsSync(p); }) == undefined ) { diff --git a/uvu-tests/config-docs.test.ts b/uvu-tests/config-docs.test.ts index 1df6710424..6d31a4d73e 100644 --- a/uvu-tests/config-docs.test.ts +++ b/uvu-tests/config-docs.test.ts @@ -33,11 +33,6 @@ Suite("Ensures that URLs correspond to docs pages", () => { icon: "bolt", title: "About", entries: [ - { - title: "Introduction", - slug: "/about/", - forScopes: ["oss"], - }, { title: "Projects", slug: "/about/projects/",