From 55be19ede7da743a18ca38e7be87cb49e495071d Mon Sep 17 00:00:00 2001 From: dealerweb Date: Sun, 31 May 2026 12:39:14 +0200 Subject: [PATCH] Feature: admin toggle for search-engine indexing (robots) Add a 'Search Engine Indexing' toggle under Settings -> General. Off (the default) emits robots noindex/nofollow in the document head - the safe default for a private webmail; on lets an admin opt the deployment into indexing. Backed by the existing admin config-manager (SEARCH_ENGINE_INDEXING env var / admin override / revert), read server-side in the root generateMetadata(). --- app/(main)/admin/_tabs/settings.tsx | 1 + app/(main)/layout.tsx | 5 +++++ lib/admin/types.ts | 1 + 3 files changed, 7 insertions(+) diff --git a/app/(main)/admin/_tabs/settings.tsx b/app/(main)/admin/_tabs/settings.tsx index 63468cf7..cbd6b4c1 100644 --- a/app/(main)/admin/_tabs/settings.tsx +++ b/app/(main)/admin/_tabs/settings.tsx @@ -125,6 +125,7 @@ export function SettingsTab() { )} + diff --git a/app/(main)/layout.tsx b/app/(main)/layout.tsx index 05572ca3..65d4bba1 100644 --- a/app/(main)/layout.tsx +++ b/app/(main)/layout.tsx @@ -49,6 +49,11 @@ export async function generateMetadata(): Promise { return { title: process.env.APP_NAME || process.env.NEXT_PUBLIC_APP_NAME || "Webmail", description: t("meta_description"), + // A private webmail should not be indexed by search engines. This is opt-in + // via Settings -> General; the default (false) emits noindex/nofollow. + robots: configManager.get("searchEngineIndexing", false) + ? { index: true, follow: true } + : { index: false, follow: false }, appleWebApp: { capable: true, statusBarStyle: "black-translucent", diff --git a/lib/admin/types.ts b/lib/admin/types.ts index 4a89ba26..b2a7e8bd 100644 --- a/lib/admin/types.ts +++ b/lib/admin/types.ts @@ -136,6 +136,7 @@ export const CONFIG_ENV_MAP: Record