Technical SEO

XML Sitemaps: What They Are and How to Submit One

A sitemap XML is a file, usually at /sitemap.xml, that lists the URLs on your website you want search engines to crawl, with optional details such as when each page last changed. It helps Google discover pages, especially on large or new sites, but it is a hint and does not guarantee crawling or indexing.

This guide shows what a sitemap.xml contains, whether you need one, how to generate it, how to submit it in Search Console and what to check afterwards. Sources are checked as of 12 November 2026.

A sitemap.xml file listing URLs, with a Googlebot check mark and a Submit button

What is an XML sitemap?

An XML sitemap is a file that tells search engines which pages and files you think are important and how they relate. Google reads it to crawl a site more efficiently. XML, short for Extensible Markup Language, is a structured text format that crawlers can parse easily. Most sites name the file sitemap.xml and place it at the root of the domain.

What does a sitemap.xml look like?

A sitemap lists each page inside a <urlset> element, with one <url> entry and one <loc> address per page. These three tags are the only required ones, and the file must declare the sitemaps.org namespace.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.example.com/services/</loc>
    <lastmod>2026-11-11</lastmod>
  </url>
</urlset>

<lastmod> is optional. The protocol also defines <changefreq> and <priority>, but Google ignores both.

What is a sitemap index?

A sitemap index is a file that lists other sitemap files instead of pages. You need one when a single sitemap would exceed the limits: 50,000 URLs or 50MB uncompressed, which means multiple sitemaps. Splitting by content type, such as posts and products, is also common.

How is it different from an HTML sitemap?

An XML sitemap is written for search engines, while an HTML sitemap is a normal web page written for visitors. Semrush describes the first as supporting crawling and indexing and the second as supporting navigation. Our own site has both: an XML file for crawlers and an HTML sitemap page at /sitemap/.

02

Do you need an XML sitemap?

Not always, but most sites benefit. Google says that if your pages are properly linked, it can usually discover most of your site, and that a sitemap is most useful in three cases:

  • Your site is large, so some pages may not be linked from anywhere Googlebot has visited.
  • Your site is new and has few external links, because crawlers find pages mainly by following links.
  • You publish a lot of rich media, such as video and images, or appear in Google News.

Google counts a site of about 500 pages or fewer, with comprehensive internal linking, as one that may not need one. Even then, Google says most sites still benefit. A sitemap does not guarantee that the pages in it will be crawled or indexed, and it does not replace good internal linking, which is how crawlers normally find your pages.

What should go in your sitemap?

List the canonical, indexable URLs you want to appear in search results, and nothing else. Google says to include the URLs you want to see in its results and to use fully qualified, absolute URLs. Because Google shows canonical URLs, choose your preferred version of any duplicated page and include only that one.

Leave out redirected URLs, pages that return errors, noindex pages, parameter variations, staging URLs and internal search results. Semrush says a sitemap should reference only URLs that return a 200 status and that you want indexed. If you have duplicate pages, our guide to duplicate content explains how to choose the preferred URL.

What about lastmod, priority and changefreq?

Use <lastmod> only when it is accurate, and ignore the other two. Google says it uses <lastmod> if it is consistently and verifiably accurate, and that the value should reflect the last significant update, such as a change to main content, structured data or links. Changing only a copyright year is not significant. The sitemaps protocol says the same: the date should show when the page changed, not when the sitemap was generated. Google ignores <priority> and <changefreq>.

04

How do you create an XML sitemap?

Let your website software generate it. Google says the best way is to have your site software produce the file, and that sitemaps with more than a few dozen URLs need to be generated rather than written by hand.

Does your CMS already make one?

Probably. Google says a content management system (CMS) such as WordPress, Wix or Blogger usually publishes a sitemap already. Semrush says WordPress has generated one by default since version 5.5, at /wp-sitemap.xml, and that Shopify does too. Check by visiting yourdomain.com/sitemap.xml. Drupal and Joomla need a module or extension.

How do you generate a sitemap in Next.js?

Add a sitemap.ts file to the app folder that returns your URLs. This is the pattern our own site uses, simplified:

// src/app/sitemap.ts
import type { MetadataRoute } from 'next';

export default function sitemap(): MetadataRoute.Sitemap {
  return [
    { url: 'https://www.example.com/', lastModified: '2026-11-11' },
    { url: 'https://www.example.com/services/' },
  ];
}

Add lastModified only when you know the real edit date.

Can you use an online generator or write one by hand?

Yes, for small sites. Google says you can write a sitemap by hand in a text editor if you have fewer than a few dozen URLs, and use a generator tool for more. Online generators are fine for a one-off, but they produce a snapshot that goes stale as you add pages, so a generated file that updates itself is better.

How do you submit a sitemap to Google?

Make the sitemap reachable, tell Google where it is and check the result. Follow these steps:

  1. Publish the file. Put it at the root, such as https://www.example.com/sitemap.xml, and open it in your browser to check that it loads.
  2. Add it to [robots.txt](/tools/robots-txt-generator/). Add the line Sitemap: https://www.example.com/sitemap.xml anywhere in the file. Google and Digital.gov both describe this, and you can list more than one.
  3. Verify your site in [Search Console](/blog/gsc-opportunities/). You need owner permission on the property to submit a sitemap.
  4. Test the URL. Run a live URL inspection and confirm that Page fetch is "Successful".
  5. Submit it. Open the Sitemaps report, paste the sitemap URL into "Add a new sitemap" and click Submit.
  6. Read the status. "Success" means it was processed with no errors, "Has errors" means it loaded but contains problems and "Couldn't fetch" means Google could not retrieve it.
  7. Check the discovered pages. The report shows how many URLs Google parsed from the file.

Google fetches the sitemap right away, but crawling the URLs can take time and Google says submitting a sitemap is merely a hint.

How do you find your sitemap?

Try /sitemap.xml on your domain first, then /wp-sitemap.xml for WordPress. Look in your robots.txt file for a Sitemap: line, which should give the exact address. In Search Console, the Sitemaps report lists the files you have submitted.

06

How do you check and fix sitemap problems?

A valid sitemap loads, follows the protocol and contains only indexable, canonical URLs. For wider fixes, see fixing technical SEO issues. Check these points:

  • It loads. Search Console shows "Couldn't fetch" when Google cannot retrieve it. Google lists causes including robots.txt blocking, a manual action, a 404 and a temporary server problem.
  • It is within limits. One file may hold up to 50,000 URLs and 50MB uncompressed, and must be UTF-8 encoded.
  • Every URL belongs. Compare the count with the pages you expect to be indexed. Redirected, broken and noindex URLs should not be listed.
  • One host. All URLs in a sitemap must come from a single host.

What does a real sitemap look like?

Here is ours. On 12 November 2026 our built sitemap held 118 URLs in a single file, well within the limits, and our robots.txt points to it with a Sitemap: line. When we last checked, on 11 November, all 118 URLs returned a 200 status and pointed to themselves as canonical.

We take <lastmod> seriously. Until 11 November the sitemap gave every URL the date of the build, which told Google that all 118 pages changed every time we deployed. It now uses a page's real last-edit date or publish date, and leaves the tag out when we have neither, which currently covers 73 pages. Two things we have not changed: all 118 entries still carry <priority> and <changefreq>, which Google ignores, so they are harmless noise; and the root URL is listed without a trailing slash.

Which sitemap mistakes should you avoid?

MistakeWhy it hurtsFix
Listing redirected, broken or noindex URLsSends Google to pages you do not want shownList only canonical, indexable URLs
Using the build date as lastmodBreaks the trust Google needs in the valueUse the real edit date or omit it
Relying on priority and changefreqGoogle ignores themSpend the time on internal links instead
Exceeding 50,000 URLs or 50MBThe file is not validSplit it and use a sitemap index
Blocking the sitemap in robots.txtGoogle reports "Couldn't fetch"Allow the file
Mixing hosts or protocolsAll URLs must share a hostUse one host and https
Expecting submission to cause indexingIt is a hintFix links, quality and duplicates as well

A worked example from this website

Our static site generates its XML sitemap from the same route list used for page export. When the solicitor guide was consolidated into the industry page, we removed the old route from that list and added a permanent redirect. This keeps the sitemap focused on canonical pages that answer a current intent. The sitemap should not include the old address merely because it still responds with a redirect.

You can reproduce the check on any small site. Fetch sitemap.xml, count its URLs, and compare each entry with its final response and canonical tag. A URL that redirects, 404s or canonicalises elsewhere needs review. Also compare the sitemap with the pages users can reach through body links. A valid XML file alone cannot make a page useful enough to index.

For help with the checks, read the technical SEO checklist, our technical SEO service and the free SEO audit.

FAQs

Frequently asked questions

Need something more specific? Request a free audit

01What is sitemap.xml used for?

It lists the URLs you want search engines to discover and crawl, so Google can find new or poorly linked pages sooner. It can also carry the last modified date of each page and details of images, video and other versions.

02What is XML and what is its purpose?

XML is Extensible Markup Language, a structured text format for storing and exchanging data. Search engines use it for sitemaps because it is easy to parse.

03Do I need a sitemap for my website?

Google says you may not need one if your site has about 500 pages or fewer and is comprehensively linked internally. A sitemap is most useful for large sites, new sites with few links and sites with a lot of rich media. Most sites still benefit from one.

04Is a sitemap good for SEO?

It helps, mainly by helping Google discover your pages, but it is not a ranking boost. Google says it is a hint and does not guarantee crawling or indexing, so it works best alongside good internal links and canonical URLs.

05Does every website have a sitemap?

No. Many content management systems create one automatically, but you may have to add it yourself. Google says a site of about 500 pages or fewer that is comprehensively linked may not need one.

06Is an XML sitemap a ranking factor?

No. It helps Google discover pages, and Google says it does not guarantee that pages will be crawled or indexed. Rankings still depend on content, links and relevance.

07How many URLs can a sitemap contain?

One sitemap can hold up to 50,000 URLs or 50MB uncompressed. If you exceed either limit, split it into several files and list them in a sitemap index.

08Does Google use priority and changefreq?

No. Google ignores both values. It uses <lastmod> only if it is consistently and verifiably accurate.

09Where should the sitemap be located?

At the root of your site is best. Google says a sitemap posted at the root can affect all files on the site, whereas one in a subdirectory affects only that directory and below unless you submit it through Search Console.

10How often should I update my sitemap?

Update it whenever pages are added, removed or significantly changed. If your CMS or site software generates it, this happens automatically; a hand-written file needs manual updates.

11What is the difference between an XML sitemap and a robots.txt file?

A robots.txt file tells crawlers what they may or may not fetch, while a sitemap lists what you would like them to find. The two work together, because robots.txt can point crawlers to the sitemap with a Sitemap: line.

12How long does it take Google to process a sitemap?

Google fetches it as soon as you submit it, but crawling the URLs can take longer, and not every URL may be crawled. Check the Sitemaps report for the status and the number of discovered pages.

13Do XML sitemaps matter for AI search?

Indirectly, according to Yoast. AI search features rely on the traditional index, so your pages generally need to be crawled and indexed before they can appear in AI-generated answers. Treat that as Yoast's view rather than a Google statement.

Free SEO audit

Get a straight answer on what to fix first.

Request a free SEO audit and we will come back with the largest constraint on your organic growth and the first practical fix. No sales sequence.

Prefer to hire through Upwork? Hire me on Upwork

SEO Agency Leeds Chat on WhatsApp [email protected] Serving Leeds, West Yorkshire and the wider UK, with remote delivery for US clients