Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: add noindex to route
Marc Seitz98e6c4aa1c04
diff --git a/lib/middleware/domain.ts b/lib/middleware/domain.tsindex a1c87257..f49f1a43 100644--- a/lib/middleware/domain.ts+++ b/lib/middleware/domain.ts@@ -18,7 +18,11 @@ export default async function DomainMiddleware(req: NextRequest) {// Subdomain available, rewriting// >>> Rewriting: ${path} to /view/domains/${host}${path}`url.pathname = `/view/domains/${host}${path}`;- return NextResponse.rewrite(url, PAPERMARK_HEADERS);+ const response = NextResponse.rewrite(url, PAPERMARK_HEADERS);++ // Add X-Robots-Tag header for custom domain routes+ response.headers.set("X-Robots-Tag", "noindex");+ return response;} else {// redirect plain custom domain to papermark.io, eventually to it's own landing pagereturn NextResponse.redirect(diff --git a/next.config.mjs b/next.config.mjsindex 2162e27a..5e712949 100644--- a/next.config.mjs+++ b/next.config.mjs@@ -41,6 +41,15 @@ const nextConfig = {},],},+ {+ source: "/view/:path*",+ headers: [+ {+ key: "X-Robots-Tag",+ value: "noindex",+ },+ ],+ },];},experimental: {