From ce4cdbf8a54d024ea9a4ce42b5683518be1b21f4 Mon Sep 17 00:00:00 2001 From: Guanzhou Song Date: Thu, 30 Jul 2026 13:04:29 -0400 Subject: [PATCH] Fix sitemap: include the /packages page, exclude the exported 404 page Verified against the first production sitemap (268 URLs): - /packages/ was missing. The top-level 'packages' exclusion was meant for the package-repository metadata the deploy workflow adds, but the Next.js /packages download page also exports to out/packages/ - and the workflow only ever adds release-info.json there (not a page), and only after the sitemap step has already run. Stop excluding it. - /404/ was listed. With trailingSlash the export emits out/404/ index.html alongside out/404.html; the directory form needs an explicit exclusion. Re-tested against a mock out/ tree that now models the real export shape (404/ directory, packages/ page plus release-info.json). --- scripts/generate-sitemap.mjs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/generate-sitemap.mjs b/scripts/generate-sitemap.mjs index 0aa5688..50aa062 100644 --- a/scripts/generate-sitemap.mjs +++ b/scripts/generate-sitemap.mjs @@ -12,15 +12,18 @@ const siteUrl = 'https://documentdb.io'; const outDir = path.join(process.cwd(), 'out'); // Top-level build outputs that are not HTML pages: Next.js assets, the APT/RPM -// package repositories, release metadata, and images. The packages workflow -// adds deb/, rpm/, and packages/ after this script runs in the deploy job, but -// they are excluded here too so local full builds behave identically. +// package repositories, images, and the not-found page (with trailingSlash the +// export emits out/404/index.html alongside out/404.html). The packages +// workflow adds deb/ and rpm/ after this script runs in the deploy job, but +// they are excluded here too so local full builds behave identically. Note +// that out/packages/ is NOT excluded: it is the exported /packages download +// page; the workflow only adds release-info.json (not a page) next to it. const excludedTopLevelDirectories = new Set([ '_next', 'deb', 'rpm', - 'packages', 'images', + '404', ]); function xmlEscape(value) {