Help search engines to better understand your website with an XML sitemap.
Help search engines understand your website structure and know which pages to crawl by implementing an XML sitemap.
What is an XML Sitemap?
An XML sitemap is a structured list of the pages on your website that you'd like search engines to crawl and index. It's a useful tool to help search engine crawlers understand your website structure, know which pages to crawl, their relative importance and when they were last updated.
XML is a markup language much like HTML. The sitemap file is commonly stored as sitemap.xml in the root directory of your web server.
Note: A robots.txt file is a file on your site you can use to tell search engine crawlers which pages not to index, such as the confirmation page for your contact form or your shopping cart page. It's important to be consistent between your XML sitemap and robots.txt file and not have conflicting information about a page.
While not essential for SEO, an XML sitemap is a good idea for a number of reasons:
A sitemap presents a clear structure.
A sitemap helps search engine crawlers understand the structure of your website and helps them prioritize the most important pages to crawl initially.
A sitemap provides temporal information.
Including the <lastmod> and <changefreq> tags in your xml sitemap tells search engines when a page was last modified and how often it's likely to change. Updating and improving content on a regular basis is good SEO practice and including these tags is a reminder for search engines to update their version of the page.
A sitemap helps crawlers to index pages with no internal links.
Some of your pages may not have internal links pointing to them, making it difficult for search engines to crawl them. A sitemap helps search engines to find all of the important pages on your site. The flip side of this is that a well constructed sitemap can disguise poor on-site navigation so it's important to pay attention to how both search engine crawlers and humans navigate to your site.
XML Sitemap Generators
The task of creating and maintaining an XML sitemap will depend greatly on the size of your website. Luckily there are some great XML sitemap generator tools that do a lot of the heavy lifting and automatically update your sitemap as you make changes to your website. Here are a few of the most popular tools:
XML Sitemap Example
A little knowledge of the structure of an XML sitemap can be valuable whether you a rolling your own or using one of the sitemap generator tools mentioned above.
Here's a basic example of an XML sitemap that includes just two website pages for illustration purposes. Each <url> tag contains a number of tags that help describe the page to search engine crawlers.
<loc> contains the full location of your page and should begin with the protocol (e.g. http:// or https://)
<lastmod> contains the date the page was last modified. Time can optionally be included here using the W3C Date and Time Format.
<changefreq> contains the frequency with which you expect the page to be update. Values can include always, hourly, daily, weekly, monthly, yearly, and never.
<priority> contains a value between 0.0 and 1.0 and signals to search engines how important pages are on your site relative to each other. The default value is 0.5. Assigning a higher value to a page indicates to search engines that you place more importance on that page in terms of crawl priority.
Learn more about the XML sitemap format
Making Your Sitemap Available
Once you have uploaded your sitemap to your website or used a third party tool to generate it for you, it should be available at a url like this: https://mywebsite.com/sitemap.xml
Placing the following line in your robots.txt file will let search engine crawlers know about it:
Submitting Your XML Sitemap to Google
You can also submit your sitemap directly to Google using their Search Console Sitemaps tool.