Short definition
XML sitemap — a file that gives search engines a list of the pages you want found, with extra details for each address, such as the date of the last change or the language versions.
Also known as: sitemap, xml sitemap, sitemap.xml.
A sitemap is a file that tells search engines which pages of your website you want them to find. Usually it is an XML sitemap: a list of addresses for crawlers, with extra details for each page, such as the date of the last change. An HTML sitemap is something else: a regular page with links, meant for visitors.
What is an XML sitemap for?
Search engines mostly find pages through links: from your menu, from other pages, and from other websites. A sitemap also gives them a complete list. According to Google Search Central’s introduction to sitemaps, Google reads the file to crawl your site more efficiently. The sitemap shows which pages you consider important, when they last changed, and which language versions belong together.
The format is defined in the Sitemaps protocol on sitemaps.org. Google, Bing, and other search engines read the same format. Google also accepts an RSS feed or a plain text file with one address per line, but the XML version can carry the most information.
Do you need a sitemap?
Google is candid about this: a site with about 500 pages or fewer, where you can reach every important page through links from the homepage, is usually found without a sitemap. A sitemap helps most when:
- your site is large. The more pages you have, the more likely a new page is not linked anywhere yet.
- your site is new. Without links from other websites, Google has few ways in.
- you have a lot of video, images, or news. A sitemap can pass along extra details for those.
A sitemap is still useful for a small site. Most systems generate one automatically, and the Sitemaps report in Search Console shows for each submitted page whether Google has picked it up. That makes indexing problems easier to spot.
What belongs in a sitemap?
An XML sitemap contains a <url> block for each page with at least a <loc>: the full address, including https://. Everything else is optional. These are the rules that matter in practice:
- Only pages you want in Google. List the canonical URL, not the variants with filters or parameters, and leave out pages with
noindexor a redirect. - Use
lastmodonly if it is accurate. Google uses the last-modified date only when it is consistently and verifiably correct. Use the date of the last real content change, not the moment the sitemap was generated. - You can skip
priorityandchangefreq. Google ignores both values. - At most 50,000 addresses or 50 MB per file. Beyond that, split the list over several sitemaps and bundle them in a sitemap index: a small sitemap that points to the others.
- Language versions can go in too. With
xhtml:linkentries, you list the translations of each page. That is one of the three ways to set up hreflang.
The file must use UTF-8 and ideally sits in the root of your domain. According to Google, a sitemap in a subfolder only covers the pages in that folder, unless you submit it through Search Console.
Example: the straffesites.com sitemap
Our site has a sitemap index at https://straffesites.com/sitemap-index.xml, which points to one sitemap with every page. We rebuild it on every deploy. This is the entry for the canonical URL term as it looked on November 23, 2026, indented to keep it readable:
<url>
<loc>https://straffesites.com/begrippen/canonical-url</loc>
<lastmod>2026-09-28T11:40:28.000Z</lastmod>
<xhtml:link rel="alternate" hreflang="nl" href="https://straffesites.com/begrippen/canonical-url"/>
<xhtml:link rel="alternate" hreflang="en" href="https://straffesites.com/en/glossary/canonical-url"/>
</url>Two choices stand out. The lastmod comes from the Git history: it is the moment the content of that page last changed, not the moment of the build. If a page shows definitions of other terms, a change to those counts too. A page we do not touch keeps its old date: this one had not changed since late September. And the language versions come from the same list of page pairs as the hreflang links in the HTML, so the two can never drift apart.
On November 23, 2026, the sitemap held 281 addresses. By Google’s guideline, we did not strictly need one. We keep it anyway, because it carries the language versions and because Search Console shows for each page what Google does with it. If you build with Astro and a headless CMS yourself, read our guide to localized sitemaps in Astro and Storyblok.
How do you submit a sitemap?
There are two common ways, and you can use both:
- Through robots.txt. Add a
Sitemap:line with the full address of your sitemap to your robots.txt file. Every search engine that reads robots.txt then finds the sitemap on its own. If you have a sitemap index, the address of the index is enough. - Through Google Search Console. Open the Sitemaps report and enter the address. There you also see whether Google could read the file and how many of its pages are indexed. The steps are in our guide to setting up Google Search Console.
Submitting a sitemap is a hint, not a command. Google decides when it crawls and which pages it indexes.
Common mistakes
- Pages in the sitemap that you do not want in Google. Test pages, thank-you pages, or pages with
noindexsend mixed signals. Search Console then lists them as not indexed or flags them with a warning. - A sitemap that points to redirects or 404s. After a site move or a new URL structure, old addresses sometimes stay in the list.
- A
lastmodthat changes on every build. If every page gets a new date each day, Google learns the value is wrong and ignores it. - A different URL format than on your site. If the sitemap uses
https://www.and the site useshttps://without www, or one has a trailing slash and the other does not, you send Google to redirects.
Not sure whether your sitemap, robots.txt, and indexing line up? We check that as a standard part of our SEO services for small businesses.
Reliable sources
Read Google Search Central’s introduction to sitemaps, Google’s guide to building and submitting a sitemap, and the full format in the Sitemaps protocol on sitemaps.org.
