XML Sitemap and robots.txt配合:2026年抓取预算优化的正确方法
How to use XML Sitemap and robots.txt to optimize crawling budget, the answer is to let the two files handle different segments: the sitemap is responsible for providing the list of addresses worth crawling, and robots.txt is responsible for declaring paths that are not worth crawling. The crawling budget is the amount of crawling that the site can allocate in a unit of time, which is affected by the update rhythm of the site and the server response, so the real operable space is in 'Don't spend the budget on invalid addresses', rather than adding weight numbers to the page.
First, clarify the division of labor between the two.
A sitemap is an enumerable list that tells the crawler 'which pages are here and when they might change'. The robots.txt is a statement of access, telling the crawler 'these paths should not be requested'. The two have different ways of becoming invalid: if a category is missing in the sitemap, those pages can only be passively discovered through internal links; if one extra exclusion is written in robots.txt, it may block the directory that you want to include, while the addresses in the sitemap are still listed, forming a contradiction of 'listed but cannot enter'.
The sitemap address should be written in the robots.txt
It is a common practice to write the location of the sitemap into the robots.txt: Use a line of Sitemap declaration in the file to indicate the map address, so that the crawler can discover the entry along with reading the access declaration, without relying solely on backend submission. The value of this step lies in supplementing a discovery path, especially for new websites or after a domain change, as the probability of passive discovery is already low.
Note a few points: The declared address must be a real accessible final address, avoiding redirection to old domain names; multiple maps (articles, images, categories) can be declared line by line; the robots.txt itself must be directly accessible, and returning an error page is equivalent to invalid declaration.
The three most common wastes in crawling budget
The first category is the repeated crawling of valueless paths: in-site search result pages, lists with filtering parameters, login and backend prefixes. These addresses are numerous but should not be indexed. The correct practice is to exclude them in robots.txt and not put them in the site map.
The second type is when addresses that should not be included mix into the list: paths excluded, draft pages, or historical archives are written into the sitemap. The crawler attempts to access them and is blocked, which is equivalent to wasting the budget on invalid requests. The sitemap should only contain the addresses of formal documents, and content in draft or pending publication status should not appear.
The third type is the change not submitted in time: after the column is revised and the URL structure is adjusted, the old address is neither used for 301 redirect convergence nor updated on the map, causing the crawler to repeatedly traverse the historical structure. Especially easy to miss this step after the pseudo-static rule adjustment, the rule has changed but the map is still the old path, and the two sides do not match.
The recommended landing sequence
Do it in the order of 'first reduce invalid, then supplement valid'. The first step is to sort out the exclusion list, write the search page, parameter page, and background prefix into robots.txt; the second step is to regenerate the site map, confirm that it only contains formal content, and declare the sitemap address in robots.txt; the third step is to actively push the recently added and revised addresses to search engines using link push to shorten the waiting time for discovery; the fourth step is to observe the differences between inclusion and crawling, see which addresses have always been in the list but not caught, and check the server response and internal link depth back.
This action does not need to be done every day, but it needs to be run every time the column structure, URL form, or pagination logic changes, especially for sites that automatically generate site maps, changing the rules once is equivalent to rewriting the entire list.
Common questions
robots.txt has been excluded, does it matter if the address is still in the site map?It matters. If there are entries in the list that are blocked by requests, it will cause the crawling party to waste resources on invalid addresses, and it will also make the inclusion status difficult to explain. Both sides should check with the same standard.
Can the site set its own crawling budget?Cannot be set directly. What can be changed is the exclusion of invalid paths, the cleanliness of the list, and the redirection and promotion of old addresses after revision, which determine how many effective收录 can be obtained with the same crawling volume.
Is it better to have a larger sitemap?No. The value of the map lies in covering the formal content to be included, and putting in archive pages, filter pages, and addresses without inclusion value will only dilute the effective crawling.