Key takeaways
- An XML sitemap helps Google find your URLs. It does not guarantee that they will be crawled or indexed.
- A small site of about 500 pages or fewer that is well linked internally may not need one.
- List only canonical URLs you want in search, as absolute URLs in a UTF-8 file, up to 50MB or 50,000 URLs per file.
- Google ignores priority and changefreq, and uses lastmod only when it is accurate.
- Submit through Search Console’s Sitemaps report or a Sitemap line in robots.txt. Google retired the sitemap ping endpoint in 2023.
An XML sitemap is one of the simplest files on a website, and one of the most misunderstood. Most of the advice in older guides, including the first version of this one, was about tuning values Google does not read and pinging an address that no longer works. Generating a clean sitemap and submitting it properly takes an afternoon at most, and I check it at the start of every technical SEO review.
This guide covers generating the sitemap and submitting it. If Search Console already reports problems with a WordPress sitemap, my guide on fixing persistent WordPress sitemap errors picks up from there.
I first published this article in 2025 and have rewritten it, removing statistics I could not trace to any source and advice that no longer applies.
Do you need an XML sitemap?
Google’s sitemap overview describes a sitemap as “a file where you provide information about the pages, videos, and other files on your site”. It lists the cases where one helps most: “Your site is large.”, “Your site is new and has few external links to it.”, and “Your site has a lot of rich media content (video, images) or is shown in Google News.”
It is equally clear about who may not need one. A small site, which Google defines as “about 500 pages or fewer”, that is “comprehensively linked internally” can be found without it. And it sets expectations: a sitemap “doesn’t guarantee that all the items in your sitemap will be crawled and indexed.”
In practice I still set one up on almost every site. Most platforms generate it for free, and a submitted sitemap gives you a per-sitemap view of indexing in Search Console, which is useful on its own.
What belongs in an XML sitemap
A sitemap is a list of the pages you want in search, not a list of every URL the site can produce. Google’s guide to building and submitting a sitemap notes that “Google generally shows the canonical URLs in its search results”, so the sitemap should name the URL you prefer for each page.
| URL type | In the sitemap? | Why |
|---|---|---|
| Canonical pages that return 200 | Yes | These are the pages you want found |
| URLs that redirect | No | List the final address instead |
| Pages marked noindex | No | You are asking Google to find a page you told it not to index |
| Filter, sort and tracking parameter URLs | No | List the canonical version only |
| Pages that return 404 or 410 | No | Remove them when the page goes |
| Staging or test URLs | No | They should not be public at all |
The technical rules are short:
- “Use fully-qualified, absolute URLs in your sitemaps”, on your preferred hostname and https.
- “The sitemap file must be UTF-8 encoded.”
- Place it at the root where you can. Google explains that “a sitemap affects only descendants of the parent directory”, while “a sitemap posted at the site root can affect all files on the site.”
- “All supported formats limit a single sitemap to 50MB (uncompressed) or 50,000 URLs.” Larger sites split it into several files and list them in a sitemap index.
Priority, changefreq and lastmod
Many generators still add priority and changefreq tags. Google says plainly: “Google ignores <priority> and <changefreq> values.” It uses lastmod only when it is “consistently and verifiably (for example by comparing to the last modification of the page) accurate.” In its June 2023 announcement, Google said it uses lastmod “as a signal for scheduling crawls to URLs that we previously discovered”, and that it should reflect the “last significant modification”, not a changed footer or a new copyright year.
A minimal, valid entry looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/services/roof-repair/</loc>
<lastmod>2026-11-20</lastmod>
</url>
</urlset>
How to generate an XML sitemap
Google notes that “Most content management systems (CMS) automatically generate sitemaps”. There are three realistic routes, and the right one depends on how the site is built.
- Your CMS or platform. The best option when it exists, because the sitemap updates whenever content changes. On WordPress, check whether the built-in sitemap or an SEO plugin’s sitemap is the one in use, and make sure only one of them is live and submitted.
- A crawler-based generator. Useful for a small static site. The risk is that it lists whatever it finds, redirects and parameter URLs included, and it goes stale the moment you publish something new unless you run it again.
- A custom sitemap from the database. For large shops and content sites. Split it by type (pages, products, categories, articles) and list the files in a sitemap index, so a problem in one file is easy to spot.
Whatever the route, generate the sitemap from the same source as the live site. A sitemap built once and uploaded by hand is out of date within weeks.
How to submit an XML sitemap to Google
Google lists several ways to submit a sitemap. These are the three that matter for most sites.
- The Sitemaps report in Search Console. Enter the sitemap URL and submit. You need owner permissions for the property.
- The Search Console API, for developers who manage many sites.
- A line in robots.txt. Google says “Insert the following line anywhere in your robots.txt file”. It works without a Search Console account:
Sitemap: https://www.example.com/sitemap_index.xml
The sitemap ping endpoint is gone
Older guides, plugins and scripts still “ping” Google with the sitemap URL. On 26 June 2023 Google announced the “deprecation of the sitemaps ‘ping’ endpoint”, said “the endpoint will stop functioning in 6 months”, and that requests to it “will result in a 404 error.” Its reason was blunt: unauthenticated submissions “are not very useful”, and “the vast majority of the submissions lead to spam.” Google said you can still “submit your sitemaps through robots.txt and Search Console.”
So if a plugin or deployment script still sends a sitemap ping to Google, it is doing nothing useful for Google. Accurate lastmod dates in a sitemap Google already knows about are what count now.
After you submit, what to check
Google’s help page for the Sitemaps report explains its three statuses. “Success” means “The sitemap was loaded and processed successfully with no errors.” “Has errors” means “The sitemap could be fetched, but has one or more errors.” “Couldn’t fetch” means “The sitemap could not be fetched for some reason.” For the last one, check that robots.txt does not block the file, that the URL loads in a browser, and “Confirm the error in the URL Inspection tool.”
Then use the part of the report most people miss: “You can filter the Page indexing report by sitemap to see how many page URLs in this sitemap have been indexed.” Splitting sitemaps by type makes this filter far more useful, because you can see at once whether products, articles or service pages are the ones not being indexed.
Two more things worth knowing. Removing a sitemap from the report does not make Google forget it: “Google won’t forget the sitemap or any URLs listed in it.” And I do not resubmit an unchanged sitemap. Google already knows where it is.
A sitemap is a list of promises, so every URL in it should be a page you want found and every date in it should be true.
XML sitemap checklist
- Decide whether the site needs a sitemap. If it is large, new or poorly linked, it does.
- Generate it from the CMS or the database, not by hand.
- Include only canonical, indexable URLs that return 200, on your preferred hostname and https.
- Remove priority and changefreq if you like; Google ignores them. Keep lastmod only if it is accurate.
- Stay under 50MB uncompressed or 50,000 URLs per file, and use a sitemap index for more.
- Add the Sitemap line to robots.txt and submit the sitemap in Search Console.
- Turn off any old sitemap ping to Google in plugins or scripts.
- Check the Sitemaps report status, then filter Page indexing by sitemap.
FAQ
Does submitting an XML sitemap get my pages indexed?
Not on its own. Google says a sitemap does not guarantee that the items in it will be crawled and indexed. It helps Google find URLs; the pages still need to be worth indexing.
Should I still ping Google when my sitemap changes?
No. Google deprecated the sitemap ping endpoint in June 2023 and said it would stop working six months later. Keep lastmod accurate and submit through Search Console or robots.txt instead.
Do priority and changefreq matter?
Not for Google, which says it ignores both values. Leaving them in does no harm, but time spent tuning them is wasted.
Can I submit more than one sitemap?
Yes. Each file is limited to 50MB uncompressed or 50,000 URLs, and you can list several sitemaps in a sitemap index and submit that one file. Splitting by content type also makes the indexing data easier to read.