Skip to content

Commit 2c4a881

Browse files
authored
[Docs Site] Add noindex to 404 pages (#23665)
1 parent 4f708ee commit 2c4a881

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/pages/404.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const props = {
1010
template: "splash",
1111
editUrl: false,
1212
feedback: false,
13+
noindex: true,
1314
},
1415
hideTitle: true,
1516
hideBreadcrumbs: true,

src/pages/[product]/404.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const props = {
2727
tableOfContents: false,
2828
editUrl: false,
2929
feedback: false,
30+
noindex: true,
3031
},
3132
hideTitle: true,
3233
hideBreadcrumbs: true,

worker/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,14 @@ export default class extends WorkerEntrypoint<Env> {
105105

106106
if (!section) return response;
107107

108-
return this.env.ASSETS.fetch(`http://fakehost/${section}/404/`);
108+
const notFoundResponse = await this.env.ASSETS.fetch(
109+
`http://fakehost/${section}/404/`,
110+
);
111+
112+
return new Response(notFoundResponse.body, {
113+
status: 404,
114+
headers: notFoundResponse.headers,
115+
});
109116
}
110117

111118
return response;

0 commit comments

Comments
 (0)