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);