How many addresses can a single site map file write, and how many files need to be split if exceeded?
The limit of a single Sitemap file is about 50,000 addresses in a file, uncompressed up to about 50 gigabytes. This constraint is for a single file, not the entire site. If any number is exceeded, the addresses need to be split into multiple files, and then an index file is used to summarize these slices; what really needs to be monitored is not how many addresses are written in a single file, but whether the full formal document has been covered.
The limit refers to a single file, not the entire site
The protocol specifies the constraints for each file: the number of items limit and the volume limit, either of which must be split. The total number of addresses for the site is not subject to this level of restriction, so even several million items are fine, just not all in the same file. The volume is calculated based on uncompressed size, the download size after compression is a separate matter, so it is more secure to estimate based on uncompressed volume when planning.
What should it be split into after exceeding the limit
The output of the split is two types of files: several piece files, each below two limits; plus one index file, listing the addresses of all the pieces. The crawling end reads the index file first, and then expands each piece according to the index. That is to say, the index file itself almost will not exceed the limit, it only contains piece links, not specific page addresses.
| File type | What to install | Affected by the single file limit or not | What to do if exceeded |
|---|---|---|---|
| Piece files | Specific page address | Affected, about 50,000 or about 50 gigabytes | Continue to cut smaller pieces by dimension |
| Index file | Addresses of each piece | Generally not affected | Rarely triggered, can be nested with an index layer |
Slice by category or by time
The dimension selection affects whether the 'slice' will be stable long-term. Slicing by category, the category itself changes slowly, and the same batch of addresses will fall into the same slice each time it is generated, making it easy to control in scale. Slicing by time, as the archive continuously moves forward, the boundary slice will keep changing, and the slice closer to the current time will be larger. Most sites are more convenient to slice by category, and some very large categories are sliced again within the category.
How to confirm that nothing is missed when automatically generated within the site
The generation end is responsible for only one thing: full coverage. Write the addresses of the formal documents into the slices, and do not include the addresses in the drafts and recycling bin. After landing, you need to check three points - whether all the slices are hung in the index files, whether the index files can be found from the root directory of the site, and whether the addresses rewritten by the pseudo-static rules are consistent with the addresses in the slices. Only when these three points are aligned can we talk about being completely read by the crawling end.
Common questions
Question: The site only has a few thousand items, do you need to split it?No need. A few thousand items are far below the single file limit, a slice file plus index or a file directly can be used, don't do layering for non-existent problems.
What if the limit is exceeded without splitting?The file is still readable, but the crawling end may only process up to the limit number, the addresses beyond that are as if they have not been accounted for, and the collection will be missing a piece for a long time and not easy to find.
Do you need to keep the historical versions of the shards all the time?The sitemap expresses the addresses that are currently expected to be caught, and it is usually sufficient to regenerate the full volume and cover the old ones each time, without needing to accumulate history.