Skip to content

fix: prevent dev/staging subdomains from being indexed by search engines#17748

Merged
pettinarip merged 4 commits into
stagingfrom
fix/seo-noindex-subdomains-staging
Mar 10, 2026
Merged

fix: prevent dev/staging subdomains from being indexed by search engines#17748
pettinarip merged 4 commits into
stagingfrom
fix/seo-noindex-subdomains-staging

Conversation

@pettinarip
Copy link
Copy Markdown
Member

@pettinarip pettinarip commented Mar 10, 2026

Summary

Cherry-pick of #17741 (merged into dev) into staging.

  • Sets NEXT_PUBLIC_SITE_URL per branch so canonical URLs and noindex meta tags resolve correctly at build time
  • Derives IS_PRODUCTION_DEPLOY from deploy context instead of URL hostname check
  • Inlines SITE_URL at build time via next.config.js so deploy previews get correct URLs

Test plan

  • Verify staging.ethereum.org pages have <meta name="robots" content="noindex, nofollow">
  • Verify staging.ethereum.org canonical URLs point to staging.ethereum.org, not ethereum.org
  • Verify ethereum.org (production) is unaffected

Use NEXT_PUBLIC_CONTEXT (already inlined at build time via next.config.js)
instead of parsing SITE_URL hostname. This ensures IS_PRODUCTION_DEPLOY is
false on all non-production deploys (branch deploys, deploy previews),
closing the canonical URL leak for arbitrary branch deploys where SITE_URL
would fall through to "https://ethereum.org".
Move the SITE_URL fallback chain (NEXT_PUBLIC_SITE_URL → DEPLOY_PRIME_URL
→ DEPLOY_URL → URL) into next.config.js env config so it gets resolved at
build time and inlined by webpack. This ensures SSR pages on deploy
previews and branch deploys use the correct deploy-specific URL instead of
falling through to "https://ethereum.org".
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 10, 2026

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit c45325d
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/69b04cc77af36000089a308e
😎 Deploy Preview https://deploy-preview-17748.ethereum.it
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 55 (🟢 up 2 from production)
Accessibility: 94 (🟢 up 1 from production)
Best Practices: 100 (no change from production)
SEO: 99 (no change from production)
PWA: 59 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added config ⚙️ Changes to configuration files tooling 🔧 Changes related to tooling of the project labels Mar 10, 2026
Netlify does not support `[[context.*.headers]]` syntax in netlify.toml.
Headers cannot be scoped per deploy context directly. Removing the broken
X-Robots-Tag header blocks — the remaining SEO protections (robots.txt
disallow and noindex meta tags) still work correctly.
@pettinarip pettinarip merged commit f9e74b0 into staging Mar 10, 2026
7 checks passed
@pettinarip pettinarip deleted the fix/seo-noindex-subdomains-staging branch March 10, 2026 17:03
@wackerow wackerow mentioned this pull request Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config ⚙️ Changes to configuration files tooling 🔧 Changes related to tooling of the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants