diff --git a/packages/astro/src/build/sitemap.ts b/packages/astro/src/build/sitemap.ts index bca69dd8a..d1e15636f 100644 --- a/packages/astro/src/build/sitemap.ts +++ b/packages/astro/src/build/sitemap.ts @@ -1,5 +1,4 @@ import type { BuildOutput } from '../@types/astro'; - import { canonicalURL } from './util.js'; /** Construct sitemap.xml given a set of URLs */ @@ -7,11 +6,12 @@ export function generateSitemap(buildState: BuildOutput, site: string): string { const uniqueURLs = new Set(); // TODO: find way to respect URLs here - // TODO: find way to exclude pages from sitemap + // TODO: find way to exclude pages from sitemap (currently only skips 404 pages) // look through built pages, only add HTML for (const id of Object.keys(buildState)) { if (buildState[id].contentType !== 'text/html') continue; + if (id === '/404.html') continue; uniqueURLs.add(canonicalURL(id, site).href); } diff --git a/packages/astro/test/fixtures/astro-rss/src/pages/404.astro b/packages/astro/test/fixtures/astro-rss/src/pages/404.astro new file mode 100644 index 000000000..23df09841 --- /dev/null +++ b/packages/astro/test/fixtures/astro-rss/src/pages/404.astro @@ -0,0 +1,10 @@ +--- +--- + + + 404 + + + 404 + +