Skip to content

Open source CapCut alternative.

TypeScript

fix(site): keep build assets out of the search index

David Le320e908008fe
diff --git a/site/next.config.ts b/site/next.config.ts
index b4f1a37e..115e8429 100644
--- a/site/next.config.ts
+++ b/site/next.config.ts
@@ -29,6 +29,15 @@ const nextConfig: NextConfig = {
serverActions: { bodySizeLimit: "4gb" },
proxyClientMaxBodySize: "4gb",
},
+ // Build assets are fetched by search crawlers to render pages, which puts
+ // every chunk, stylesheet and font in Search Console as a candidate page.
+ // The header lets them be fetched and keeps them out of the index.
+ headers: async () => [
+ {
+ source: "/_next/static/:path*",
+ headers: [{ key: "X-Robots-Tag", value: "noindex" }],
+ },
+ ],
// Cut is local-only: /api/cut/* 404s on a hosted deploy and never runs the
// engine. But Turbopack's file tracer still follows the route's import of the
// engine router, and that graph reaches cwd-rooted file operations it can't
diff --git a/site/src/app/robots.ts b/site/src/app/robots.ts
new file mode 100644
index 00000000..f27ffe6b
--- /dev/null
+++ b/site/src/app/robots.ts
@@ -0,0 +1,18 @@
+import type { MetadataRoute } from "next";
+
+import { DONKEYCUT_CANONICAL } from "@/cut/lib/hosts";
+
+// Served at donkeycut.com/robots.txt. The proxy matcher skips paths with an
+// extension, so this route answers directly on every host. Build assets under
+// /_next/ stay crawlable because Google fetches them to render the pages;
+// the noindex header in next.config.ts keeps them out of the index.
+export default function robots(): MetadataRoute.Robots {
+ return {
+ rules: {
+ userAgent: "*",
+ allow: "/",
+ disallow: ["/api/", "/app/", "/su/", "/sign-in", "/sign-up", "/unsubscribe"],
+ },
+ sitemap: `${DONKEYCUT_CANONICAL}/sitemap.xml`,
+ };
+}