fix(seo): Add noindex for platform and business subdomains
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user