Skip to content

Open-source status page, incident response and uptime monitoring

status page: robots no index (#2335)

Thibault Le Ouay45cd071b63d8
diff --git a/apps/status-page/src/app/robots.ts b/apps/status-page/src/app/robots.ts
index dc3db8bab..9b1d57a80 100644
--- a/apps/status-page/src/app/robots.ts
+++ b/apps/status-page/src/app/robots.ts
@@ -26,13 +26,31 @@ export default async function robots(): Promise<MetadataRoute.Robots> {
: null;
const row = route
? await db
- .select({ slug: page.slug, customDomain: page.customDomain })
+ .select({
+ slug: page.slug,
+ customDomain: page.customDomain,
+ allowIndex: page.allowIndex,
+ })
.from(page)
.where(
sql`lower(${page.slug}) = ${route.prefix} OR lower(${page.customDomain}) = ${route.prefix}`,
)
.get()
: undefined;
+
+ // The page owner opted out of indexing: disallow everything and omit the
+ // sitemap so crawlers have nothing to follow.
+ if (row && !row.allowIndex) {
+ return {
+ rules: [
+ {
+ userAgent: "*",
+ disallow: "/",
+ },
+ ],
+ };
+ }
+
const sitemap = row
? `${getBaseUrl({ slug: row.slug, customDomain: row.customDomain ?? undefined })}/sitemap.xml`
: undefined;