diff --git a/README.md b/README.md index b2a12d23..f58e5d1e 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ OpenSSF Best Practices License Stars + Website Live Demo Discord Sponsor diff --git a/apps/landing/public/_headers b/apps/landing/public/_headers new file mode 100644 index 00000000..c1325ef9 --- /dev/null +++ b/apps/landing/public/_headers @@ -0,0 +1,5 @@ +/_next/static/* + X-Robots-Tag: noindex, nofollow + +/_next/data/* + X-Robots-Tag: noindex, nofollow diff --git a/apps/landing/public/_redirects b/apps/landing/public/_redirects new file mode 100644 index 00000000..e69de29b diff --git a/apps/landing/public/_worker.js b/apps/landing/public/_worker.js new file mode 100644 index 00000000..7c6fb5bc --- /dev/null +++ b/apps/landing/public/_worker.js @@ -0,0 +1,24 @@ +export default { + async fetch(request, env) { + const url = new URL(request.url); + + if (url.hostname === "www.snapotter.com") { + url.hostname = "snapotter.com"; + return Response.redirect(url.toString(), 301); + } + + const response = await env.ASSETS.fetch(request); + + if (url.pathname.startsWith("/_next/static/") || url.pathname.startsWith("/_next/data/")) { + const headers = new Headers(response.headers); + headers.set("X-Robots-Tag", "noindex, nofollow"); + return new Response(response.body, { + status: response.status, + statusText: response.statusText, + headers, + }); + } + + return response; + }, +};