Skip to main content
Starter Kit - Ships with your template. You own it - modify freely.

Overview

The Robots.txt ensemble generates a standards-compliant robots.txt file for controlling search engine crawler behavior. It provides a flexible, configurable approach to managing bot access with support for:
  • Block all crawlers or allow with exceptions
  • Custom path restrictions (e.g., /api/*, /admin/*)
  • Crawl delay configuration
  • Sitemap reference
  • CDN/browser caching (24-hour cache by default)
The ensemble serves robots.txt at the /robots.txt endpoint with proper HTTP cache headers for optimal performance.

Endpoint

Response Type: text/plain Cache Headers:
  • Cache-Control: public, max-age=86400, stale-while-revalidate=3600
  • 24-hour cache duration
  • 1-hour stale-while-revalidate window

Configuration Options

disallowAll

Type: boolean Default: false Description: When true, blocks all search engine crawlers from accessing any part of your site.
Generated Output:

disallowPaths

Type: array of strings Default: ["/api/*", "/admin/*", "/_*"] Description: List of path patterns to disallow. Supports wildcards (*). Only applied when disallowAll is false.
Generated Output:

crawlDelay

Type: number (seconds) Default: null (no delay) Description: Requests crawlers to wait this many seconds between successive requests. Helps reduce server load.
Generated Output:

sitemap

Type: string (URL) Default: https://example.com/sitemap.xml Description: URL to your XML sitemap. Search engines use this to discover all pages on your site.
Generated Output:

Customization Examples

Example 1: Development Site (Block All)

Block all crawlers during development or staging:

Example 2: Production Site with Protected Paths

Allow crawlers but protect sensitive paths:

Example 3: Public Site with Minimal Restrictions

Allow most content, only block internal paths:

Example 4: Aggressive Crawler Throttling

Slow down aggressive bots:

Full Ensemble YAML

Testing Your Configuration

Test Locally

Validate with Google

After deploying, use Google’s Robots Testing Tool to validate your robots.txt configuration.

Common Scenarios

Scenario 1: Verify API paths are blocked
Scenario 2: Check sitemap reference
Scenario 3: Verify cache headers

Best Practices

  1. Update the sitemap URL: Replace https://example.com/sitemap.xml with your actual sitemap URL
  2. Review default disallow paths: Customize the disallowPaths array to match your site structure
  3. Consider crawl delay: Set crawlDelay only if experiencing high bot traffic
  4. Test before deploying: Always test changes locally first
  5. Monitor crawler behavior: Use Google Search Console to track how bots interact with your site
  6. Keep it simple: Only disallow what’s necessary; over-blocking can hurt SEO

Sitemap Generator

Generate XML sitemaps for search engines to discover your content