An XML sitemap is one of the most important factors in Search Engine Optimization as it helps in the successful crawling and indexing of your website. Especially if your website is large enough with plenty of URLs, you should have an XML sitemap for your website. Here you will know about the XML sitemap and its best practices. In addition, you will also know how to validate your website’s XML sitemap.
What is XML Sitemap and How to Create?
An XML sitemap is a file that lists all the indexable website pages to help Google and other search engines easily crawl your website. This sitemap resides at the root of your website like https://www.example.com/sitemap.xml
You can create an XML sitemap manually or by using a tool like XML Sitemaps Generator. The basic format of an XML sitemap is like this:
In this basic format code, you can ignore <changefreq> and <priority> as these values are optional and Google ignores these values.
XML Sitemap Best Practices
There are some DO’s and DON’Ts under XML sitemap best practices. If you follow these best practices in your website’s XML sitemap then it will improve website crawling and indexing of all your web pages.
DO’s for XML Sitemap
- Add only working URLs, with 200 status codes, in your XML sitemap.
- Include the only canonical version of URLs, preferred URLs, in the sitemap.
- Prefer to keep URLs from the single host in your sitemap like www.example.com/sitemap.xml should have only URLs under www.example.com/
- Leverage a sitemap index file, if you have multiple XML sitemaps for your website, which can have URLs of those multiple XML sitemaps.
- It’s recommended to make your XML sitemap dynamic or automated. This can add new or updated pages and remove any deleted pages automatically. So no manual action is needed.
- Include your XML sitemap URL in the robots.txt file like Sitemap: https://www.example.com/sitemap.xml in your https://www.example.com/robots.txt file.
- Submit your XML sitemap to Google Search Central and Bing Webmaster regularly in case of any changes in website URLs (add, remove or update in URLs).
- The maximum size of your XML sitemap can be 50,000 URLs or 50 MB. Additionally, you can see what John Mueller said recently about the maximum number of URLs in an XML sitemap.
DON’Ts for XML Sitemap
- Don’t include broken URLs or URLs with 4XX status code in the XML sitemap.
- Don’t include redirecting URLs or URLs which redirect to some other URLs.
- Non-indexable URLs, internal, thank you, or confidential pages with meta robots “noindex”, should not be added in your sitemap.
- Don’t include URLs with parameters to avoid duplicate URLs in the sitemap.
- Don’t create an XML sitemap if you don’t update your website’s content.
- Exclude non-canonical URLs in the sitemap.
- Don’t include paginated URLs in your sitemap.
- Internal search result pages should not be included.
- Pages that have been blocked in robots.txt should not be included in the sitemap.
- You don’t need to create an XML sitemap for your website if it’s a one-pager or has very few pages. As in these cases, Google crawls and indexes your website pages with ease.
- Remember Google treats any website as small if it has a total of 500 or fewer indexable pages.
- Your website should have good internal linking between different web pages even if it’s a small website as if you are not creating an XML sitemap due to less number of pages.
How to Validate XML Sitemap?
Once you create an XML sitemap for your website then it’s good to regularly keep a validation check on the XML sitemap. Google Search Central can help you in this as within Sitemap under Index section it shows submission status for your XML sitemap like ‘Sitemap index processed successfully’ in below screenshot or if not successful then it shows errors under index coverage.
Another way to do XML validation is through XML Sitemap Validator as it shows either your sitemap is valid or not, warnings or errors if any.
Creating and regularly taking care of your XML sitemap helps in better crawling and indexing of your website. So you should consider all XML sitemap best practices by following Do’s and Don’ts. You should also validate your sitemap regularly.
Do you have a small website and you don’t need an XML sitemap? Or do you have a big website and you need multiple XML sitemaps? You can share your XML sitemap experience in the comments section below to help all.