Astro Integration
Astro NoIndex
Protect non-production Astro sites from search engine indexing — safely, explicitly, and at build time.
Last Updated: 01 April 2026
Usage Snapshot
33
Downloads in Last 30 Days
v1.0.1
Latest npm Version
Source: npm registry
Why This Plugin Exists
Accidental indexing of staging and preview sites is a common and costly SEO mistake.
astro-noindex prevents this by enforcing noindex rules during the build process, not at runtime.
The result is deterministic, adapter-agnostic, and immune to environment misconfiguration.
Design Principles
- Build-time enforcement only
- Explicit allow-listing
- No environment guessing
- No runtime middleware
- Respect existing SEO decisions
What This Plugin Delivers
- Injects noindex, nofollow meta tags at build time
- Explicit hostname allow-listing
- Never overrides existing robots meta tags
- Works with static and hybrid output
- Adapter-agnostic and CDN-safe
- Zero runtime JavaScript
Installation
npm install astro-noindex
The plugin runs during astro build and injects noindex directives into generated HTML when the site hostname is not allow-listed.
FAQs
What problem does Astro NoIndex solve?
It prevents staging, preview, and development Astro sites from being indexed by search engines.
Does Astro NoIndex run at runtime?
No. The plugin runs exclusively at build time and produces static HTML output.
Does it override existing robots meta tags?
No. If a page already defines a robots meta tag, astro-noindex does nothing.
Implementation FAQs
Why does Astro NoIndex exist?
Because accidental indexing of staging and preview sites causes real SEO damage and is difficult to reverse.
How does hostname allow-listing work?
Only exact hostnames listed in the allow array are permitted to be indexed. All others receive noindex directives.
What if the site option is undefined?
If the site hostname cannot be determined, astro-noindex applies noindex by default.
What if a page already defines a robots meta tag?
astro-noindex respects explicit user intent and does not modify pages that already include a robots meta tag.
Does Astro NoIndex require middleware or adapters?
No. It performs static HTML mutation at build time only.
Is Astro NoIndex compatible with CDNs?
Yes. The output is static, cache-safe, and works behind any CDN.
Project Links
Source code, package distribution, releases, and documentation.
Need Implementation Details?
Read the FAQs for usage patterns, integration caveats, and rollout guidance.