summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/astro/src/build/sitemap.ts4
-rw-r--r--packages/astro/test/fixtures/astro-rss/src/pages/404.astro10
2 files changed, 12 insertions, 2 deletions
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<string>();
// TODO: find way to respect <link rel="canonical"> 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 @@
+---
+---
+<html>
+ <head>
+ <title>404</title>
+ </head>
+ <body>
+ 404
+ </body>
+</html>