fix(landing): add www redirect, noindex JS chunks, and website badge

Edge worker 301-redirects www.snapotter.com to snapotter.com to stop
Google from splitting domain authority. Adds X-Robots-Tag: noindex on
/_next/static/ and /_next/data/ paths to reclaim crawl budget wasted
on JS chunks. Adds snapotter.com website badge to README so the
highest-authority backlink (GitHub) points to the main site.
This commit is contained in:
SnapOtter
2026-06-13 11:09:02 +08:00
parent 82991b6a41
commit 47b6984be0
4 changed files with 30 additions and 0 deletions
+24
View File
@@ -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;
},
};