From 6554e62d3083df64a88d561e09f0ea445f8cc53a Mon Sep 17 00:00:00 2001 From: poduck Date: Thu, 4 Dec 2025 10:08:47 -0500 Subject: [PATCH] fix(seo): Add noindex for platform and business subdomains MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dynamically set robots meta tag to noindex/nofollow when on any subdomain (platform.*, demo.*, etc.). Only the root domain marketing pages should be indexed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- frontend/src/App.tsx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index ae48061..755c70a 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -191,6 +191,30 @@ const AppContent: React.FC = () => { localStorage.setItem('darkMode', JSON.stringify(darkMode)); }, [darkMode]); + // Set noindex/nofollow for app subdomains (platform, business subdomains) + // Only the root domain marketing pages should be indexed + React.useEffect(() => { + const hostname = window.location.hostname; + const parts = hostname.split('.'); + const hasSubdomain = parts.length > 2 || (parts.length === 2 && parts[0] !== 'localhost'); + + // Check if we're on a subdomain (platform.*, demo.*, etc.) + const isSubdomain = hostname !== 'localhost' && hostname !== '127.0.0.1' && parts.length > 2; + + if (isSubdomain) { + // Always noindex/nofollow on subdomains (app areas) + let metaRobots = document.querySelector('meta[name="robots"]'); + if (metaRobots) { + metaRobots.setAttribute('content', 'noindex, nofollow'); + } else { + metaRobots = document.createElement('meta'); + metaRobots.setAttribute('name', 'robots'); + metaRobots.setAttribute('content', 'noindex, nofollow'); + document.head.appendChild(metaRobots); + } + } + }, []); + // Handle tokens in URL (from login or masquerade redirect) React.useEffect(() => { const params = new URLSearchParams(window.location.search);