There are various reasons why you might want to have multiple sitemap files in just one directory. If your website is very active, you sure will want to have a daily sitemap to take care of time-sensitive URLs and a weekly one for not-so-time-bound URLs. You can have as many sitemaps as you want so long as all the listed URLs are in a sub directory or a common location as the sitemap. What matters here is to ensure that the sitemaps shouldn’t have URLs from parent directories or entirely dissimilar directories. In the event that the above happens, the metadata won’t be trusted because it won’t be certain that the submitter has any control over the URL’s directory.
There are some known limitations associated with sitemaps. First, it shouldn’t be larger than 10 MB, and shouldn’t contain URLs exceeding 50,000. It is for this reason that you must use sitemap index if you intend to design a website with numerous sitemaps and directories.
With a sitemap index, you can include numerous sitemap files in just a single file known as sitemap index. The index uses similar index but the URLs have to be added to sitemaps as opposed to including the web pages’ URLs.
Find a sample sitemap index code below.
As clearly visible in the above sample, the following XML tags are used by the sitemap index;
The <lasmod> and <loc> tags are similar the ones in any normal sitemap file. Information regarding an independent sitemap is summarized by the <sitemap> tag while the <sitemapindex> tag offers information regarding every sitemap contained in the file. Always remember that sitemap files can only be files situated in the same subdomain or domain and has to be UTF-8 encoded too.
Your sitemap should be placed into your web server’s directory, this is highly recommended. This is because the set of URLs that can included in your sitemap’s file is determined by where it is located.
Example: A sitemap file that is located below a subdirectory can have links of all the pages in the very subcategory but not those above it.