Glossary
Sitemap.xml
A sitemap.xml is an XML file that lists the URLs on a website, optionally with when each page last changed, so search engines, crawlers and AI agents can discover and refresh the site's pages efficiently.
A sitemap.xml is an XML file that lists the URLs on a website, usually with the date each page last changed. It tells search engines and other crawlers which pages exist and which have been updated, so they can find pages that are hard to reach through links and avoid re-fetching pages that have not changed.
The format comes from the Sitemaps protocol, which Google introduced in 2005 and which Yahoo and Microsoft then adopted, with the shared specification published at sitemaps.org. A sitemap is a hint, not a command: listing a page does not guarantee it will be crawled or indexed, and leaving one out does not hide it. For anyone building a web crawler or feeding a website into an AI system, though, the sitemap is usually the cheapest and most complete list of a site’s pages available.
What a sitemap.xml contains
A sitemap is a urlset element containing one url element per page. Each url has a required loc with the page’s full address and up to three optional tags.
Element | Required | What it holds |
|---|---|---|
loc | Yes | The absolute URL of the page, including the protocol |
lastmod | No | When the page’s content last changed, in W3C date format |
changefreq | No | How often the page is expected to change, such as daily or monthly |
priority | No | The page’s relative importance on the site, from 0.0 to 1.0 |
In practice lastmod is the only optional tag that matters much. Google has said it ignores changefreq and priority and uses lastmod when a site keeps it consistently accurate. A lastmod that changes on every build, whether or not the content did, teaches crawlers to disregard it.
The file must be UTF-8 encoded, URLs must be absolute and properly escaped, and a sitemap should only list URLs on the same host as the sitemap itself. The urlset element declares the sitemaps namespace, which matters if you parse the file with XPath: an expression such as “//url/loc” finds nothing until the namespace is registered or matched with local-name().
Size limits and sitemap index files
One sitemap file can hold at most 50,000 URLs and must be no larger than 50 MB uncompressed. Files can be gzip-compressed to save bandwidth, but the limit applies to the uncompressed size.
Larger sites split their URLs across several sitemaps and list those files in a sitemap index, a second XML format whose sitemap entries each point to one sitemap file with an optional lastmod. An index can list up to 50,000 sitemaps. Big sites often split by section or content type, such as one sitemap for products, one for articles and one for help pages, which makes it easy to see which part of a site changed and to regenerate only that file.
Generating a sitemap
Most content management systems and site frameworks produce a sitemap automatically, either built in or through a plugin, and regenerate it when content is published. Static site generators usually write one during the build. Sites with content in a database, such as shops and marketplaces, often serve the sitemap dynamically from a query, split into pages of a few thousand URLs each.
Whatever the method, the important choices are the same. Take lastmod from the time the content itself changed, not the time the file was generated. Include only canonical, indexable pages. Split large sites by section so that each file changes only when its section does. And regenerate on every publish, so new pages appear in the sitemap the moment they go live.
Extensions for images, video, news and languages
The basic protocol only describes pages, so search engines added extensions. Image sitemaps list images on each page, video sitemaps describe video content with titles, durations and thumbnails, and news sitemaps flag recent articles for news search. Multilingual sites can add alternate links that point each page to its translations, which helps search engines show the right language version.
These extensions use extra namespaces inside the same file. Crawlers that only need page URLs can ignore them, but they are a useful source of structured metadata when present, for example the thumbnail URL and duration of every video on a site.
How crawlers find and use sitemaps
There are three common ways a crawler finds a site’s sitemap. The most reliable is a Sitemap line in robots.txt, which can appear anywhere in the file and can be repeated for several sitemaps. The second is the conventional location at /sitemap.xml in the site root, which many crawlers try by default. The third is direct submission through tools such as Google Search Console and Bing Webmaster Tools, which also report errors and how many listed URLs were indexed.
Once it has the sitemap, a crawler typically adds every loc to its queue, compares lastmod with the date it last fetched each page, and prioritises new and changed URLs. For a site with thousands of pages, that comparison is the difference between re-fetching everything on every run and fetching the few dozen pages that changed.
A sitemap does not override access rules. A well-behaved crawler still checks robots.txt for each URL, identifies itself with a clear user agent, and keeps its request rate reasonable. A URL listed in the sitemap but disallowed in robots.txt should not be fetched, and a mismatch like that is usually a site configuration error.
A worked example: a documentation site
Say you want an AI assistant to answer questions from a product’s documentation site, which has about 1,200 pages and changes several times a week.
On the first run, the ingestion job fetches robots.txt, reads the Sitemap line, downloads the sitemap index and the docs sitemap it points to, and collects 1,200 URLs with their lastmod dates. It fetches each page, removes navigation and other page furniture with boilerplate removal, converts the main content with HTML to Markdown, and stores the results with their URLs and lastmod values.
On each later run, the job downloads the sitemap again and compares. Pages with a newer lastmod are re-fetched and re-processed, new URLs are added, and URLs that have disappeared from the sitemap are flagged for removal. A typical daily run touches perhaps 20 pages rather than 1,200. This is incremental indexing driven by the sitemap, and it is one of the simplest defences against stale knowledge in a knowledge base.
The weak point is lastmod accuracy. If the docs platform stamps every page with the build date, every page looks changed every day. In that case a content hash of each page’s extracted text is a better change signal, with the sitemap used only for discovering URLs.
Sitemap.xml, robots.txt and llms.txt
Three files at a site’s root are often mentioned together, and they do different jobs.
File | Purpose | Audience |
|---|---|---|
sitemap.xml | Lists URLs and when they changed | Search engines and crawlers |
robots.txt | States which paths crawlers may fetch, and where the sitemap is | All crawlers |
llms.txt | Gives language models a curated Markdown overview with key links | LLMs and AI agents |
A sitemap is exhaustive and machine-oriented. llms.txt is a newer, informal proposal that is selective and written for models, pointing to the pages that matter most, often with Markdown versions. They complement each other: an agent can use llms.txt to understand a site quickly and the sitemap to find everything else. Whether every site should publish one is discussed in should every website ship an llms.txt?
Common problems
Stale or missing sitemaps are the most common issue. Sitemaps generated once and never updated miss new pages and keep listing deleted ones. Generating the sitemap from the same source as the site, on every publish, avoids this.
Listing the wrong URLs is the second. Sitemaps should list canonical URLs that return a 200 status, not redirects, parameterised duplicates or pages marked noindex. Each listed URL should match the page’s canonical URL; a sitemap full of URLs that redirect through a redirect chain wastes crawl budget and confuses indexing.
Inaccurate lastmod values are the third, as described above. Unescaped characters, relative URLs and files over the size limit are the other errors search consoles report most often.
For crawlers, the main pitfalls are ignoring sitemap index files, failing on gzip-compressed sitemaps, and treating the sitemap as permission to fetch everything at once. Over time, pages listed in an old sitemap can also stop resolving, which is link rot; checking status codes on each run catches it.
Where Exabase fits
Exabase does not crawl sitemaps on your behalf, so the sitemap reading and URL comparison stay in your code or agent. Exabase handles what happens to each page after that.
Exabase Extract takes each URL from the sitemap, renders it with JavaScript and returns the title, site name and content as text chunks; the submitting jobs guide covers sending many URLs, and extraction webhooks deliver results without polling. Saved as Resources inside a Base, the pages are indexed for Deep Search, which returns the passage that answers a question along with its source.
Keeping the result current is the job of Workers: a scheduled Worker can re-check sources, refresh changed content, tag new material and flag what has aged out, as described on the knowledge base solution page and in knowledge bases rot. The documentation assistants use case walks through the same pattern for product docs.
Frequently asked questions
What is the purpose of a sitemap.xml?
A sitemap.xml tells crawlers which URLs exist on a site and when they last changed. It helps search engines and other crawlers discover pages, especially ones with few internal links, and refresh changed pages efficiently.
Where is the sitemap.xml file located?
It is usually at the site root, as /sitemap.xml, and its location is often declared with a Sitemap line in robots.txt. Large sites may use a sitemap index at the root that points to several sitemap files elsewhere.
How many URLs can a sitemap contain?
A single sitemap can list up to 50,000 URLs and be up to 50 MB uncompressed. Larger sites use a sitemap index that lists multiple sitemap files.
Does a sitemap guarantee my pages get indexed?
No. A sitemap is a hint that helps discovery; search engines still decide what to crawl and index based on their own signals.
Do changefreq and priority still matter?
Google has said it ignores both. An accurate lastmod is the optional tag worth maintaining.
How do AI crawlers use sitemaps?
AI crawlers and ingestion jobs use sitemaps to list a site’s pages and lastmod dates to decide which pages to re-fetch. This keeps a knowledge base current without re-processing the whole site.
Can Exabase ingest a website from its sitemap?
Yes, with your code reading the sitemap. Send each URL to Exabase Extract, store the results as Resources, and use a Worker on a schedule to keep them current.
Related pages: Robots.txt, Web crawler, XPath, llms.txt, Canonical URL, Incremental indexing, Stale knowledge, Knowledge base solution, Documentation assistants