The Ultimate Developer Guide to Robots.txt Directives & XML Sitemaps
In modern technical search engine optimization (SEO) and web administration, controlling how search bots crawl and index your site is vital for indexing efficiency and crawl budget allocation. Robots.txt acts as the gatekeeper for web crawlers (such as Googlebot, Bingbot, and AI bots), while sitemap.xml provides a structured roadmap of canonical URLs.
Our Robots.txt & XML Sitemap Generator operates 100% client-side inside your browser. No website URLs, private directories, or staging routes are ever uploaded to remote servers.
1. Robots.txt Common Directives & Bot Tokens Reference
| Directive / Crawler | Syntax Example | Action / Purpose | Supported By |
|---|---|---|---|
| User-agent: * | User-agent: * |
Applies following rules to all web spiders | All standard search crawlers |
| Disallow Directory | Disallow: /admin/ |
Blocks crawling of the specified path and sub-paths | Google, Bing, Yahoo, Yandex, Baidu |
| Allow Subpath | Allow: /admin/public/ |
Explicitly whitelists a sub-URL inside a disallowed parent | Googlebot, Bingbot |
| Block AI Bots | User-agent: GPTBot |
Prevents AI training bots from scraping website content | OpenAI (GPTBot), Anthropic (ClaudeBot) |
| Sitemap Directive | Sitemap: https://site.com/sitemap.xml |
Directs crawlers to the canonical XML sitemap location | All modern search engines |
2. XML Sitemap Schema Tags Explained
<loc>: The absolute URL of the page (e.g.https://example.com/page). Must begin with protocol (HTTP/HTTPS).<lastmod>: The date of last modification in W3C Datetime format (YYYY-MM-DD). Helps search engines discover refreshed content.<changefreq>: How frequently the page is likely to change (daily,weekly,monthly).<priority>: Relative priority of this URL compared to other URLs on your site (ranging from0.0to1.0).
3. Technical SEO Best Practices
1. Never disallow CSS, JavaScript, or theme assets in robots.txt—Googlebot needs them to render pages for mobile indexing.
2. Keep sitemap file sizes under 50MB and fewer than 50,000 URLs per individual sitemap file (use a sitemap index for larger sites).
3. Submit your sitemap directly to Google Search Console and Bing Webmaster Tools for rapid URL discovery.