Sitemaps for subdomains – How to set it the right way?
This article was updated on August 6th, 2020 at 05:57 am
So, imagine you have a main domain and a sub domain – Site A and sub.SiteA, how will you implement sitemaps for each entity?
Should you have just one sitemap under the main site or should you have two sitemaps for both the main site and the subdomain?
Let’s find out.
Sitemaps – General thumb rule for installation
The general thumb rule for installing sitemaps are on the site root folder.
i.e, if it is Site A, then siteA.com/sitemap.xml
According to Sitemap standards,
Sitemaps are an easy way for webmasters to inform search engines about pages on their sites that are available for crawling. In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL (when it was last updated, how often it usually changes, and how important it is, relative to other URLs in the site) so that search engines can more intelligently crawl the site.
Web crawlers usually discover pages from links within the site and from other sites. Sitemaps supplement this data to allow crawlers that support Sitemaps to pick up all URLs in the Sitemap and learn about those URLs using the associated metadata. Using the Sitemap protocol does not guarantee that web pages are included in search engines, but provides hints for web crawlers to do a better job of crawling your site.
So Sitemaps can be used when you have a large number of files to be indexed and want to tell search engines how to find them
Since each sitemap can only feature up to 500 links, it is advised to split them up in parts.
That is, to have a sitemap index and link to the parts from the index.
So, to answer this question, it is recommended to have the sitemap on the root folder for both the main site and the subdomain.
For Site A > Sitemap at sitea.com/sitemap_index.xml
And have another (or how many ever sitemaps you want) sitemap in the same folder, but link to them from the index sitemap.
For Subdomain (sub.SiteA.com) > Sitemap at sitea.com/sitemap_subdomain.xml
To get this done, use a free XML site generator and generate sitemaps of all the subdomains as well as main site.
Then create a sitemap index file using the following format.
<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap> <loc>http://www.example.com/sitemap.xml</loc> <lastmod>2004-10-01T18:23:17+00:00</lastmod> </sitemap> <sitemap> <loc>http://www.example.com/sitemap_subdomain.xml</loc> <lastmod>2005-01-01</lastmod> </sitemap> </sitemapindex>
Now, in the sitemap index, add the subdomain sitemaps (which are in the same folder).
Hope that helped.