An XML sitemap notifies Google and other engines about your key web pages and how they are linked. The sitemap is used by search engines to traverse your website and understand what kind of content you have and how pages are related.
According to Google:
A sitemap is a file where you provide information about the pages, videos, and other files on your site, and the relationships between them. Search engines like Google read this file to crawl your site more efficiently. A sitemap tells Google which pages and files you think are important in your site, and also provides valuable information about these files. For example, when the page was last updated and any alternate language versions of the page.
Sitemaps are a crucial component of any technical SEO strategy. You can have great content, a fantastic brand, and a thriving social media presence, but if your technical SEO isn’t up to par, you won’t get the traffic or interaction you desire. In this article, we will discuss the importance of sitemaps and provide you with guidelines from Google themself for creating the best sitemap.

Why You Need a Sitemap
The best way to notify search engines which pages, files, and content on your website are the most significant is to use an XML sitemap. The XML sitemap is used by search engines like Google to figure out what your area of expertise is and how frequently you update page content.
This is why it is so important to update your content regularly. Google likes it when you actively provide users with the most up-to-date content in the most readable formats.
Simply put, an XML sitemap is beneficial to your SEO.
You want to make it as simple as possible for search engines to crawl your website and list your content, videos, photos, and URLs in the search results page (SERP).
What to Put in Your Sitemap
There is a really simple method for determining which pages should be included in your sitemap. First, consider the significance of a URL. For example, does a URL provide any value to the person who visits it? Do you want people to go to that URL? If not, it shouldn’t be included.
If you leave pages off of your XML sitemap, that doesn’t mean the URL won’t be indexed by search engines. They can index the URL if they can find it through links. If you don’t want that URL to show up in the search results, you’ll need to include a ‘no-index’ and a ‘follow’ tag, in addition to removing that page URL from your sitemap.
Making a Sitemap Easily Understood by Google
These are Google’s guidelines for creating effective sitemaps:
- Use consistent, fully qualified URLs. Google will crawl your URLs exactly as listed. For instance, if your website is at https://www.example.com/, don’t specify a URL as https://example.com/ (missing www) or./mypage.html (a relative URL).
- A sitemap can be posted anywhere on your website, but a sitemap affects only descendants of the parent directory. Therefore, a sitemap posted at the site root can affect all files on the website, which is where we recommend posting your sitemaps.
- Don’t include session IDs from URLs in your sitemap. This reduces duplicate crawling of those URLs.
- Tell Google about alternate language versions of a URL using hreflang annotations.
- Sitemap files must be UTF-8 encoded and URLs escaped appropriately.
- Break up large sitemaps into smaller sitemaps: a sitemap can contain up to 50,000 URLs and must not exceed 50MB uncompressed. Use a sitemap index file to list all the individual sitemaps and submit this single file to Google rather than submitting individual sitemaps.
- List only canonical URLs in your sitemaps. If you have two versions of a page, list in the sitemap only the one you prefer to appear in search results. If you have two versions of your website (for example, www and non-www), decide which is your preferred website and put the sitemap there, and add rel=canonical or redirects on the other website.
- If you have different URLs for mobile and desktop versions of a page, we recommend pointing to only one version in a sitemap. However, if you want to point to both URLs, annotate your URLs to indicate the desktop and mobile versions.
- Use sitemap extensions for pointing to additional media types such as video, images, and news.
- If you have alternate pages for different languages or regions, you can use hreflang in either a sitemap or HTML tags to indicate the alternate URLs.
- Non-alphanumeric and non-latin characters. Google requires your sitemap file to be UTF-8 encoded (you can generally do this when you save the file). As with all XML files, any data values (including URLs) must use entity escape codes for the characters listed in the following table. A sitemap can contain only ASCII characters; it can’t contain extended ASCII characters or certain control codes or special characters such as * and {}. If your sitemap URL contains these characters, you’ll receive an error when you try to add it.
- Remember that sitemaps are a recommendation to Google about which pages you think are important; Google does not pledge to crawl every URL in a sitemap.
- Google ignores <priority> and <changefreq> values.
- Google uses the <lastmod> value if it’s consistently and verifiably (for example by comparing to the last modification of the page) accurate.
- The position of a URL in a sitemap is not important; Google does not crawl URLs in the order in which they appear in your sitemap.
Conclusion
Remember that the XML sitemap is crucial for SEO, so consider your SEO strategy and how you use your website to engage with visitors. Your decisions about what to include in your sitemap should be guided by these principles.
You can realize that your website is missing important pages, has dated information, or lacks high-quality content while deciding what to include in your XML sitemap. Knowing the bad can allow you to reach the good!
Remember that your website (and its XML sitemap) are not static and must be inspected, refreshed, and updated on a regular basis.