How many addresses can a single sitemap file hold, and how should it be split if it exceeds the limit?
The single Sitemap file can contain how many addresses, the protocol specifies a simultaneous effective limit of two: the number of addresses does not exceed 50,000, and the uncompressed file size does not exceed 50MB. If either of the two reaches the limit first, the content should be split into multiple Sitemap files, and each segment should be listed one by one by an index file (Sitemap index). When the scale of the site exceeds this level, the correct action is to split it, rather than retain only the first 50,000, or hope for the volume to pass after compression.
How is the limit calculated?
The limit of the number of objects that can be parsed at one time is managed, and the limit of the volume of the original bytes to be read is managed separately. Addresses with longer query parameters are more likely to exceed the volume limit first, while pure article pages are more likely to exceed the number of items limit. The protocol also requires that the file itself use UTF-8 encoding and data values to be escaped, which are two things that are easily overlooked: when the address contains Chinese characters or parameters with &, if not escaped, it will cause the entire file to fail to parse, and it is more difficult to troubleshoot than exceeding the limit.
It should be noted that the wording of the agreement is aimed at 'each provided sitemap file', the index file is also within the scope of the same sentence, when planning to split, the index file itself should also be controlled at the same level, and it should not be regarded as an unlimited summary container.
How to determine the directory after splitting
| Character | What to put inside | Who reads it | The behavior when an error occurs |
|---|---|---|---|
| Sub-sitemap file | A batch of specific page addresses and their change time | Crawling scheduling | Exceeded the number or volume, the whole batch is rejected |
| Index file | List of addresses for each sub-map file | Crawling scheduling | Omitted a sub-map, and those addresses will not be discovered for a long time |
| Submission entry | Address of index file or split sub-map | Administrator backend, external tools | Submitted sub-map has been changed to split, pointing to an empty file |
The principle of directory naming is stability and predictability. It can be divided by content module or by address area, but once decided, it is best not to change the path: every time you change the filename, the previously submitted addresses will point to an empty file, and it takes time to find a new batch of addresses. If it is necessary to change, cooperate with 301 redirect to point the old address to the new summary entry to avoid the situation where 'the submission list has it, but the content cannot be found.'
How to configure the background
The site map of AnQiCMS (AnQi CMS) is automatically generated by the background, and the slicing and indexing structure is produced according to the scale of the site. The three things that the site owner needs to confirm are:
First, the static rule determines the address form. Rule changes will cause the overall change of historical addresses, and the generator will produce completely different fragment content accordingly. Such changes should be launched simultaneously with the redirect table, and not just on one side.
Second, the submission and push channels should point to the summary entry. Use the index file address as the external submission address, so that new fragments can be automatically included, which is more convenient than submitting sub-maps one by one; at the same time, link push is still notifying new content piece by piece, and the site map is responsible for full-scale verification. The two channels do not replace each other.
Third, verify by sampling instead of just checking the existence of files. Randomly open a slice, confirm that the address quantity, encoding, and last modified time fields are all present, which is more reliable than staring at the green status on the background. For multilingual sites, also confirm that each language branch appears in the corresponding slice, to avoid the situation where a whole branch of a language is missing from the list.
Common questions
Question: Can the volume after compression be used as a judgment standard?Answer: No, the protocol sets limits based on the uncompressed volume, and compression only affects transmission.
Question: If the site is just about to reach the limit, do we need to shard now?Answer: It is recommended to split in advance. If the limit is exceeded, the entire batch will be rejected, resulting in the loss of discovery opportunities for all addresses, while splitting in advance has almost no additional cost.
Question: Can we split by year, such as one file per year?Answer: Yes, provided that the number of pieces per year does not reach the limit, and new pieces will continue to be appended to the index file. The benefit of splitting by year is that the historical file path is stable.