Robots.txt Guard

Robots.txt Guard is a copy-paste React component that stops site de-indexed by robots.txt before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/robots-txt-guard
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsSite de-indexed by robots.txt

Was this component page useful?

How do I install Robots.txt Guard?

pnpm dlx shadcn@latest add @bollard/robots-txt-guard

The files land in your project. They're yours to edit.

How do I use Robots.txt Guard in React?

robots-txt-guard-usage.tsx
import { RobotsTxtGuard } from "@/components/ui/robots-txt-guard"

return <RobotsTxtGuard production siteUrl="https://acme.com" defaultValue={copiedFromStaging} />

What input mistakes does Robots.txt Guard catch?

  • Disallow: / and staging leftovers in a production file
  • Rules that block CSS and JS asset paths used for rendering
  • Relative or wrong-host Sitemap lines
  • Directive typos and missing colons
  • Fields Google doesn't support (crawl-delay, noindex)
  • Which line decides a crawl for a given URL and user agent

What props does Robots.txt Guard accept?

RobotsTxtGuard props
PropTypeDefault
value

Controlled robots.txt text.

string—
defaultValue

Initial text when uncontrolled.

string""
onValueChange

Called with the new text on every edit or fix.

(value: string) => void—
production

The file is about to serve production, so Disallow: / and staging leftovers are flagged.

booleanfalse
siteUrl

The live origin (https://acme.com). Enables sitemap host checks and one-tap sitemap fixes.

string—
assetPaths

Extra CSS/JS paths that must stay crawlable, e.g. "/build/app.css".

string[]—
agents

Crawlers offered in the URL tester.

string[]["Googlebot", "Googlebot-Image", "Bingbot", "GPTBot"]
label

Visible label; shorthand for `messages.label`.

string—
messages

Every visible string. `{line}`, `{detail}`, `{fix}`, `{rule}`, `{agent}`, `{path}`, `{host}`, `{count}` are filled in.

Partial<RobotsTxtGuardMessages>—

* required. Also accepts the native props of <textarea> (className, aria-*, data-*…), passed through to it.

How is Robots.txt Guard accessible?

  • Visible <label> on the textarea; aria-invalid on errors and a role=status issue count
  • Each issue has a button to select its line, with an aria-label
  • After a fix, focus moves to the next fix or back to the textarea
  • URL tester inputs have labels; results use icon plus text

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Models Google's robots.txt rules; other crawlers interpret files differently
  • robots.txt controls crawling, not indexing; blocked URLs can still be indexed from links
  • Asset checks use the paths you pass

What validation rules apply to Robots.txt Guard?

Rules last verified:

Confirmed: Google supports user-agent, allow, disallow and sitemap (crawl-delay isn't supported) and uses the most specific matching user-agent group. Check the source for changes. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What expensive mistakes does Robots.txt Guard stop?

Site de-indexed by robots.txt

Also known as

robots.txt · seo · disallow · sitemap · googlebot · crawl · indexing · search console

Field type

What dependencies does Robots.txt Guard require?

Robots.txt Guard facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameRobots.txt Guard
Registry identifier@bollard/robots-txt-guard
Install commandnpx shadcn@latest add @bollard/robots-txt-guard
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Robots.txt Guard

What form validation mistake does Robots.txt Guard catch?

Robots.txt Guard prevents site de-indexed by robots.txt. Catches robots.txt rules that would quietly de-index a site, like Disallow: / in production or blocked CSS and JS. Catches: Disallow: / and staging leftovers in a production file, Rules that block CSS and JS asset paths used for rendering, Relative or wrong-host Sitemap lines, Directive typos and missing colons, Fields Google doesn't support (crawl-delay, noindex), Which line decides a crawl for a given URL and user agent. Limitation: validate robots-txt-guard schemas on backend.

How do I install robots-txt-guard with shadcn?

Run `npx shadcn@latest add @bollard/robots-txt-guard`. Sources added: registry/default/robots-txt-guard/check-robots.ts, registry/default/robots-txt-guard/robots-txt-guard.tsx. Package requirements: lucide-react.

What props customize Robots.txt Guard?

Robots.txt Guard accepts `value`, `defaultValue`, `onValueChange`, `production`, `siteUrl`. Configures robots.txt, seo, disallow behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of robots-txt-guard?

Models Google's robots.txt rules; other crawlers interpret files differently. robots.txt controls crawling, not indexing; blocked URLs can still be indexed from links. Asset checks use the paths you pass Server requirement: backend verification for robots-txt-guard.

How does Robots.txt Guard meet accessibility guidelines?

Visible <label> on the textarea; aria-invalid on errors and a role=status issue count. Each issue has a button to select its line, with an aria-label. After a fix, focus moves to the next fix or back to the textarea. URL tester inputs have labels; results use icon plus text. Minimizes errors: disallow all robots txt, site not on google.

Which components pair with Robots.txt Guard?