How to create and submit a sitemap
Generate it, host it at the root, reference it in robots.txt, submit it in Search Console once, and keep only indexable canonical URLs in it.
Submitting a sitemap is one of the highest-value, lowest-effort things you can do for a new or growing site: it hands Google a clean list of the URLs you want found. It will not force anything to be indexed — but it removes any excuse for a page to go undiscovered. Here is how to create one, put it in the right place, and submit it properly.
What you are making
An XML sitemap is a machine-readable list of your important URLs, each optionally tagged with when it last changed. If you want the full picture of what belongs in one, the size limits, and why it aids discovery rather than indexing, read what is an XML sitemap first. This guide is the practical how-to.
Step 1: create the sitemap
Pick the method that matches how your site is built — do not hand-write XML if something can generate it for you:
- A CMS or plugin. WordPress with Yoast or Rank Math, Shopify, Squarespace and Wix all generate and update a sitemap automatically. This is the right answer for most sites — an auto-maintained sitemap never goes stale.
- Your framework. Modern frameworks generate one at build time (this very site does). If yours can, use that — the sitemap is then derived from your real routes and cannot drift out of sync.
- An online generator. For a small static site with no CMS, a crawler-based generator will produce a one-off
sitemap.xmlyou upload. Fine for a site that rarely changes; a chore for one that does. - By hand. Only sensible for a handful of pages. The format is simple:
<?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-09-10</lastmod>
</url>
<url>
<loc>https://example.com/pricing</loc>
<lastmod>2026-08-22</lastmod>
</url>
</urlset>Step 2: host it at a stable URL
Put the file where crawlers expect it — the site root, so https://example.com/sitemap.xml. Use absolute URLs inside it (the full https:// address, not /pricing), and make sure loading the URL in a browser actually returns the XML.
Step 3: reference it in robots.txt
Add a single line to your robots.txt so any crawler that reads the file finds the sitemap without being told where it is:
Sitemap: https://example.com/sitemap.xmlThis is a genuinely useful step — it is how search engines other than Google, including Bing, discover your sitemap without a manual submission.
Step 4: submit it in Google Search Console
This is the “submit to Google” part everyone is looking for, and it takes under a minute:
- Open Google Search Console for your verified property.
- Go to Indexing → Sitemaps in the left menu.
- Under Add a new sitemap, enter the path — usually just
sitemap.xml— and submit. - Wait for the status to read Success. Google will report how many URLs it discovered from the file.
You submit once. Google re-reads the file on its own schedule from then on, so an auto-generated sitemap needs no further attention.
Step 5: verify it, and keep it clean
A sitemap full of the wrong URLs sends mixed signals — you are asking Google to index pages your own site says not to. Confirm it validates and that every URL in it is one you actually want indexed, using the sitemap checker. The common mistakes it catches:
- URLs that are noindexed, redirected or blocked. A sitemap should list only final, indexable, 200-OK canonical URLs. Cross- check with the indexability checker if in doubt.
- Non-canonical duplicates. List the canonical version of each page, not every parameter variant.
- A stale or faked
lastmod. Only claim a page changed when it did — a sitemap that says every page changed today, every day, teaches Google to ignore the field. - Over the limits. A single sitemap tops out at 50,000 URLs or 50 MB uncompressed; past that, split it and use a sitemap index file.
What a sitemap will not do
Be clear-eyed about it: submitting a sitemap gets your URLs discovered, not indexed. Google still decides what to index based on crawlability and value, so a sitemap is one step in a larger process. For that whole process — links, requesting indexing, and making pages worth keeping — see how to get your website indexed on Google. And if pages you submitted are sitting unindexed, the discovered — currently not indexed guide explains why a URL Google knows about can still be waiting.
Frequently asked questions
- How do I submit a sitemap to Google?
- Create your sitemap, host it at your site root (for example https://example.com/sitemap.xml), then open Google Search Console for your verified property, go to Indexing then Sitemaps, enter the path under 'Add a new sitemap', and submit. Wait for the status to read Success, at which point Google reports how many URLs it found. You only need to submit once.
- How do I create an XML sitemap?
- Use the method that matches your site. A CMS or plugin like Yoast, Rank Math, Shopify, Squarespace or Wix generates and updates one automatically, which is best for most sites. Modern frameworks generate one at build time. For a small static site, an online crawler-based generator produces a file you upload. Only hand-write XML for a handful of pages.
- Do I need to resubmit my sitemap every time I publish a page?
- No. You submit a sitemap once per property, and Google re-fetches it periodically on its own afterward. An auto-generated sitemap that stays up to date needs no further attention. Resubmitting manually does not speed up indexing, so there is no benefit to doing it after every change.
- Should I put my sitemap in robots.txt?
- Yes. Add a line reading 'Sitemap: https://example.com/sitemap.xml' to your robots.txt. This lets any crawler that reads the file find your sitemap without a manual submission, and it is how search engines other than Google, including Bing, discover it. It complements submitting in Search Console rather than replacing it.
- Why does my sitemap show errors in Search Console?
- The usual causes are URLs that should not be there — pages that are noindexed, redirected, blocked by robots.txt, or non-canonical duplicates — or a sitemap that exceeds the 50,000-URL or 50MB limit, or uses relative instead of absolute URLs. A sitemap should list only final, indexable, canonical URLs. Validate it and cross-check questionable URLs with an indexability checker.
- Will submitting a sitemap get my pages indexed?
- Not on its own. A sitemap gets your URLs discovered; Google still decides what to index based on crawlability and value. Think of it as one necessary step rather than a guarantee. Pair it with internal links, genuinely useful pages, and — for important URLs — the Request indexing tool in Search Console.