From 232eb921ed8eb6083a879d5573ef445c0bf09bce Mon Sep 17 00:00:00 2001 From: Pamela Chia Date: Wed, 30 Sep 2026 17:13:52 -0700 Subject: [PATCH] fix(docs): omit category sections from reference sitemap (#51069) The Docs sitemap lists a `/reference//undefined` URL for every reference category header, on both latest and versioned paths (for example `/reference/kotlin/v1/undefined`). `generateReferencePages` turns every flattened section into a link, and category headers never carry a slug. Search engines get a 404 for the `api/undefined` entries and a soft 404 for the SDK ones. I filtered the sections with the same predicate the reference static params already use (`type !== 'category' && !!slug` in `Reference.utils.ts`). I ran the generator locally before and after the change: the only entries it removes are the `/undefined` ones (about 4% of the sitemap), and it adds none. **Note:** `getFlattenedSections` stays unchanged because the crawler route and the reference pages share it. ## To test Tested on Vercel preview: - [x] Fetch `/docs/sitemap.xml` on the Docs preview and search for `/undefined`: expect no matches - [x] In the same file, search for `/docs/reference/javascript/select` and `/docs/reference/kotlin/v1/select`: expect both still listed ## Linear - fixes GROWTH-1310 ## Summary by CodeRabbit * **Documentation** * Reference pages no longer generate links for category sections or sections without a slug. Existing link paths and priorities remain unchanged. --- apps/docs/internals/files/reference-lib.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/docs/internals/files/reference-lib.ts b/apps/docs/internals/files/reference-lib.ts index f1dbafbf5cc..d026df7d70d 100644 --- a/apps/docs/internals/files/reference-lib.ts +++ b/apps/docs/internals/files/reference-lib.ts @@ -29,12 +29,14 @@ export async function generateReferencePages() { .map(async ({ sdkId, version, libPath, isLatestVersion }) => { const flattenedSections = await getFlattenedSections(sdkId, version) return ( - flattenedSections?.map((section) => ({ - link: isLatestVersion - ? `reference/${libPath}/${section.slug}` - : `reference/${libPath}/${version}/${section.slug}`, - priority: 0.8, - })) ?? [] + flattenedSections + ?.filter((section) => section.type !== 'category' && !!section.slug) + .map((section) => ({ + link: isLatestVersion + ? `reference/${libPath}/${section.slug}` + : `reference/${libPath}/${version}/${section.slug}`, + priority: 0.8, + })) ?? [] ) }) )