How to divide the work of the index file of the site map and the sub-maps, and where are the places that are easy to make mistakes.
How are the index file and sub-maps of the sitemap divided: the sub-maps are responsible for listing specific content addresses, and the index file is responsible for listing the addresses of these sub-maps. When the number of site addresses exceeds the limit of a single file, the protocol requires that it must be divided into multiple sub-map files, and then summarized by a single index file. The three things that are easy to get wrong are the absolute addresses of the sub-maps, file encoding and escaping, as well as the modification time corresponding to each address.
What two lines does the protocol draw for a single file?
The single site map file has two strict limits: one is that the number of addresses cannot exceed 50,000, and the other is that the uncompressed volume cannot exceed 50MB. If any of these limits are exceeded, the file should be split. The purpose of these two limits is not to limit the size of the site, but to control the parsing cost of a single crawl. Therefore, after splitting, it is not necessary to merge them back, but rather let the index file take on the role of summarizing.
The file itself must be encoded in UTF-8, and special characters appearing in the address must be escaped. These two points are often overlooked when manually generated, especially in titles or column names that contain Chinese characters, spaces, and & symbols in the address. Not escaping them will directly lead to parsing failure.
What do the index file and sub-maps each bear?
| Character | content | Upper limit constraint | Who is responsible for generating? |
|---|---|---|---|
| Sub-maps | Specific page address and modification time | Two upper limits of the number and volume | Generated in batches by column or section |
| Index file | Addresses of each sub-map | Only list sub-maps, do not list content pages | Aggregate all slices |
Do not list the content page addresses again in the index file. A common misunderstanding after slicing is that 'writing the index and sub-map once is safer,' but the actual effect is that the same address is declared twice, and the crawling budget is wasted on repeated parsing.
Another easily overlooked boundary: the sub-map and index file must belong to the same hostname. Placing the sliced files on an independent content distribution domain will be invalid due to cross-host, and such errors are particularly easy to occur after the static file relocation.
The three most common mistakes after splitting
The first one is the instability of the slice boundary.Modular slicing by article number and slicing by category, the two methods have different performance when the content grows. Modular slicing by article number will mix the content of each slice and cause frequent changes in addresses, while slicing by category is closer to the site structure, and new content usually only affects one slice. When generating the site map automatically within the site, keeping the slice boundaries stable is meaningful for the modification time of the sub-maps.
The second is that lastmod wrote the generation time.Each time the regeneration is performed, the modification time of all addresses is set to the current day, causing the crawler to mistakenly judge the entire site content as changed, thereby increasing the frequency of re-crawling. The correct approach is to take the actual release or last edited time of the page. This item is related to the time factor: within the site, it supports setting content for scheduled release, and the page going live at the scheduled time should start from the time of going live, rather than the time of scheduling entry.
The third issue is that the submitted address does not match the actual accessible address.After switching the static page switch, directory migration, or domain name change, the old address is still listed in the index file, while the sub-map itself is redirected to a new location. The method of checking is to request the address of each sub-map from the index file one by one, and see if the return code is a successful state rather than a redirect.
How to confirm the quality of the product within the site?
AnQiCMS's SEO side capabilities have streamlined these tasks into an automatic process: supports automatic generation of sitemaps, provides pseudo-static URLs, 301 redirects, and link push management for active submission to search engines. Whether the product is qualified or not cannot be solely judged by whether it 'has been generated', but needs to verify four items by sampling: whether the number and volume are within the limit, whether the index only lists sub-maps, whether the encoding is UTF-8, and whether the modification time of each address comes from the page itself.
The cost of sampling is low: Take ten rows from the first and last slices of the index, and then check whether the article at the boundary of the slices has been counted twice. Also, check the submission records of the link push, the set of push addresses should be able to find the corresponding entries in the site map, and discrepancies on both sides usually indicate that hidden categories or recycle bin content have been included in one of the lists.
Common questions
Question: If the content is less than 50,000 entries, should an index file be created directly?
Answer: It is not necessary. When a single file can cover, one sub-map is enough; the advantage of reserving the index structure is only that it does not need to adjust the submission address when scaling up later.
How will the deleted article affect the sitemap?
The crawler will obtain the invalid address. Deleting formal documents in the system is moving them to the recycle bin rather than physical deletion. Such unpublished or deleted content should not appear in the output.
Should new articles rely on the sitemap to notify search engines?
The sitemap is responsible for the complete list, and active push is responsible for timely notification. The two roles complement each other. Relying on only one will either lack fullness or timeliness.