01
Two files, two different jobs
Google describes submitting a sitemap as merely a hint: it may not download it or use it for crawling. A robots.txt file is mainly for managing crawler traffic; Google states it is not a mechanism for keeping a page out of its results. A blocked address can even appear in results without a description. Remember the rule: the sitemap suggests, robots.txt limits crawling, and only a noindex directive or password protection keeps a page out of the index.
02
What belongs in an XML sitemap?
List the pages you want to see in results, using their full canonical address. Google crawls URLs exactly as written, so a relative path such as /services will not work. Leave out redirected pages, pages marked noindex, private pages and duplicates.
- A single file must not exceed 50,000 URLs or 50 MB uncompressed; beyond that, split it and group the files in a sitemap index.
- Google ignores the priority and changefreq values.
- The lastmod date is only used if it is consistently accurate: it should reflect the last significant content change, not a new copyright year in the footer.
- Language versions can be declared in the sitemap; Google treats this method as equivalent to hreflang tags in the HTML.
03
Writing a robots.txt file without accidents
The file must sit at the root of the host, and its rules apply only to the protocol, host and port where it is published: the www and non-www versions are two hosts. Field names are case-insensitive, but path values are not. Google ignores anything beyond 500 KiB. The Sitemap line takes a full URL and applies to all crawlers.
When the file returns an error
A 4xx error other than 429 is treated as if no file existed: no restrictions apply. A 5xx server error is more serious: Google stops crawling the site for the first hours while it keeps requesting the file. Watch the robots.txt response after every hosting change.
The classic launch accident
A Disallow: / rule carried over from staging blocks the entire public site. Before switching over, compare the production file with the test one and confirm that no important page is excluded.
04
Noindex or robots.txt: which one should you use?
To remove a page from results, use noindex, either in a robots meta tag or in an X-Robots-Tag HTTP header; the header also works for a PDF or an image. The page must not be blocked by robots.txt, or the crawler will never see the directive. Keep robots.txt for limiting crawling of areas with no search value, such as endless filter combinations. For a truly private page, authentication is the only protection: anyone can read robots.txt.
05
Submitting the sitemap and checking it
Declare the sitemap in robots.txt and submit it in Search Console’s Sitemaps report, which shows when Google read it and any processing errors. Then compare sitemap URLs with your canonical URLs: a sitemap address that redirects or names another canonical sends conflicting signals. A Breighty analysis checks crawler access, indexing directives, sitemap validity and its consistency with the tested pages.
06
Your preparation checklist
Gather these details to turn the guide into a practical next step. Simply flag anything you do not yet know.
- Your robots.txt address for each host: with and without www.
- The current Disallow lines and the reason for each one.
- The sitemap address and the number of URLs it lists.
- Sitemap URLs that redirect or carry noindex.
- The last read date shown in Search Console.
Frequently asked questions
My sitemap is submitted: why aren’t my pages indexed?
A sitemap is only a hint. Check each page in URL Inspection: a noindex directive, a different canonical, a redirect or content seen as a duplicate are frequent causes. Fix the page itself before resubmitting the file.
Should I block my login pages in robots.txt?
It is not protection: the file is public and a blocked address can still appear in results. Protect the private area with authentication and add noindex to public pages that should not be indexed.
Should lastmod change with every deployment?
No. Google only uses lastmod when the date is consistently accurate. Update it when the main content of the page changes significantly, not when a deployment only touches code or the footer.
Keep going
Sources and documentation
Let’s work on your project.
Understand findings, choose fixes and verify results. Guides for working on your actual website.
Analyze my website