From e6bb26fc6f18a2c0117b6bb21128b5360557f3c0 Mon Sep 17 00:00:00 2001 From: mgreminger Date: Sat, 30 Nov 2024 12:08:20 -0600 Subject: [PATCH] fix: add nonindex header to document data Prevent google from index the sheets json data --- src/database/_worker.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/database/_worker.ts b/src/database/_worker.ts index 1cedbfc94..05f87ab4f 100644 --- a/src/database/_worker.ts +++ b/src/database/_worker.ts @@ -279,10 +279,17 @@ async function getSheet({ requestHash, kv, d1, useD1 } : if (useD1) { await incrementNumReads(requestHash, d1); } - return new Response(JSON.stringify({ - data: document.data, - history: document.history - })) + + const headers = new Headers(); + headers.append("X-Robots-Tag", "noindex"); + + return new Response( + JSON.stringify({ + data: document.data, + history: document.history, + }), + { headers: headers } + ); } }