From 2c4a8818ea8b139a18a197fd9a7802dd1fa338f3 Mon Sep 17 00:00:00 2001 From: Kian Date: Tue, 15 Jul 2025 13:59:18 +0100 Subject: [PATCH] [Docs Site] Add noindex to 404 pages (#23665) --- src/pages/404.astro | 1 + src/pages/[product]/404.astro | 1 + worker/index.ts | 9 ++++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pages/404.astro b/src/pages/404.astro index edd7cffb57..662e6c63e2 100644 --- a/src/pages/404.astro +++ b/src/pages/404.astro @@ -10,6 +10,7 @@ const props = { template: "splash", editUrl: false, feedback: false, + noindex: true, }, hideTitle: true, hideBreadcrumbs: true, diff --git a/src/pages/[product]/404.astro b/src/pages/[product]/404.astro index 2409196f7a..edb402c320 100644 --- a/src/pages/[product]/404.astro +++ b/src/pages/[product]/404.astro @@ -27,6 +27,7 @@ const props = { tableOfContents: false, editUrl: false, feedback: false, + noindex: true, }, hideTitle: true, hideBreadcrumbs: true, diff --git a/worker/index.ts b/worker/index.ts index 79122d669a..728b316593 100644 --- a/worker/index.ts +++ b/worker/index.ts @@ -105,7 +105,14 @@ export default class extends WorkerEntrypoint { if (!section) return response; - return this.env.ASSETS.fetch(`http://fakehost/${section}/404/`); + const notFoundResponse = await this.env.ASSETS.fetch( + `http://fakehost/${section}/404/`, + ); + + return new Response(notFoundResponse.body, { + status: 404, + headers: notFoundResponse.headers, + }); } return response;