How to Submit a Sitemap to Google Search Console
A sitemap is a machine-readable list of the URLs you consider canonical and worth crawling. Submitting one does not guarantee indexing — it guarantees discovery.
8 min read · Updated
On this page
A sitemap does exactly one job: it tells Google which URLs exist and are worth its attention. It is a discovery aid, not a ranking factor and not an indexing guarantee. Google will still make its own call on every URL you list — but it cannot index a page it never found, and on large or poorly linked sites a sitemap is often the only way a page gets found at all.
What a valid sitemap looks like
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-07-13</lastmod>
</url>
<url>
<loc>https://example.com/guides/</loc>
<lastmod>2026-06-02</lastmod>
</url>
</urlset>That is the whole format. Two tags matter and two do not:
| Tag | Does Google use it? |
|---|---|
<loc> | Yes — the URL. Must be absolute and fully qualified. |
<lastmod> | Yes, if it is trustworthy. Google ignores it entirely on sites that lie. |
<changefreq> | No. Google has confirmed it ignores this. |
<priority> | No. Ignored. It has never affected ranking. |
Hard limits
- 50,000 URLs per sitemap file.
- 50 MB uncompressed per file. Gzip is allowed and encouraged.
- Exceed either limit and you need a sitemap index — a sitemap that lists other sitemaps. The index itself is capped at 50,000 entries.
Submitting it
Confirm it loads
Open the sitemap URL in a browser first. If it 404s, redirects, or renders as HTML instead of XML, fix that before going near Search Console.
Reference it in robots.txt
Add a
Sitemap:line with the absolute URL. Every crawler reads robots.txt, so this exposes your sitemap to Bing and others too, not just Google.Submit in Search Console
Open the Sitemaps report, enter the path (
sitemap.xml), and submit. You only ever need to do this once per sitemap.Check back in a day or two
Status should read Success with a discovered-URL count. 'Couldn't fetch' means Google could not read it — see below.
# robots.txt
User-agent: *
Allow: /
Sitemap: https://example.com/sitemap.xmlGenerating one in Next.js
The App Router generates and serves the XML for you from a single file — no build step, no third-party package:
// src/app/sitemap.ts
import type { MetadataRoute } from "next";
export default function sitemap(): MetadataRoute.Sitemap {
return [
{ url: "https://example.com", lastModified: new Date("2026-07-13") },
{ url: "https://example.com/guides", lastModified: new Date("2026-06-02") },
];
}Derive the list from the same source your routes come from — a content directory, a CMS query, a database. A hand-maintained array is a sitemap that is wrong within a month, because the one thing nobody remembers to update when shipping a new page is the sitemap.
Rules that keep a sitemap trustworthy
- Only list URLs that return 200. No redirects, no 404s, no soft 404s.
- Only list canonical URLs. If a page canonicalizes elsewhere, it does not belong here — listing it contradicts your own canonical tag.
- Never list noindexed URLs. You are simultaneously asking Google to crawl it and refusing to let it index it.
- Use one consistent hostname. If the site serves from the apex, every
<loc>uses the apex. A sitemap full of URLs that redirect to the other hostname is how a whole site ends up filed under 'Page with redirect'. - Match your canonical tags exactly — same protocol, same host, same trailing-slash convention.
'Couldn't fetch' — what it really means
This error is badly named. It rarely means Google failed to reach the file; more often it reached it and could not accept it.
| Cause | Check |
|---|---|
| Submitted the wrong path | Try the full absolute URL in a browser |
| Returns HTML, not XML | A SPA catch-all route rewriting unknown paths to index.html |
| Wrong Content-Type | Should be application/xml or text/xml |
| Blocked by robots.txt | You disallowed the very path you submitted |
| The sitemap URL itself redirects | Submit the final destination URL |
| Reported too soon | Status can lag a day or two — 'Couldn't fetch' on a brand new sitemap often clears itself |
Once the sitemap reads Success, the story moves to the Page indexing report — that is where you find out what Google decided to *do* with the URLs you handed it.
Frequently asked questions
Does submitting a sitemap guarantee my pages get indexed?
No. A sitemap guarantees discovery, not indexing. Google still evaluates each URL independently and may file it under 'Discovered – currently not indexed' or 'Crawled – currently not indexed' if it judges the page low value.
How often should I resubmit my sitemap?
Once. After the initial submission Google re-fetches it on its own schedule, and the old ping endpoint was deprecated in 2023. Resubmitting after every deploy has no effect.
Do changefreq and priority do anything?
No. Google has confirmed it ignores both tags entirely. Only <loc> and a trustworthy <lastmod> influence crawling.
Should noindexed pages go in the sitemap?
Never. Listing a noindexed URL sends Google contradictory instructions — crawl this, but do not index it — and wastes crawl budget. The same applies to redirecting URLs and non-canonical duplicates.
How many URLs can a sitemap contain?
50,000 URLs and 50 MB uncompressed per file. Beyond that, split into multiple sitemaps and reference them from a sitemap index file.