Why do websites use sitemaps?
Short answer
A search-engine sitemap is a file listing the web addresses (URLs) of public pages on a site. Search engines can use it as a clue to find those pages.
A website’s address list
One common format is an XML file, sometimes named sitemap.xml. XML uses tags to label information. Here is an example listing three pages from a fictional company website:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/about/</loc>
</url>
<url>
<loc>https://example.com/services/</loc>
</url>
<url>
<loc>https://example.com/contact/</loc>
</url>
</urlset>
In this example, <urlset> wraps the list, <url> represents one page, and <loc> contains its full address. Repeat the whole <url> group for each page, and put that page’s URL in <loc>. The second line identifies the sitemap format. A sitemap can also include the last time something important on a page changed. That date is useful only when it is accurate.
A clue, not a command
Search engines can find pages by following links inside a site too. A sitemap can help when a site has many pages or when a new page is hard to reach through links.
A sitemap does not force a search engine to visit every listed URL or show every page in search results. The search engine makes those decisions. Here, “sitemap” means the file search engines read; a page that lists links for visitors has a different purpose.