Search Engine Indexing

XML Sitemaps: How to Create, Submit, and Actually Use One

An XML sitemap is a file — usually at /sitemap.xml — that lists the URLs on your site you want search engines to know about. You create it (most CMS platforms do it automatically), reference it in robots.txt, and submit it once in Google Search Console and Bing Webmaster Tools. It helps engines discover pages faster. It does not force them to index anything.

That last sentence is the part most guides skip, so let's start there and work outward.

What does an XML sitemap actually do?

A sitemap is a discovery aid, not an instruction. It answers one question for a crawler: what URLs exist on this site, and when did they last change? That's it.

Crawling and indexing are two separate steps. Crawling is a bot fetching your page. Indexing is the engine deciding to store that page and make it eligible to appear in results. A sitemap helps with the first step and has no authority over the second. A URL can sit in a perfectly valid sitemap and never get indexed — which is exactly what's happening when Search Console reports crawled or discovered but currently not indexed.

So a sitemap earns its keep in specific situations:

  • New sites with few or no inbound links, where crawlers have little else to follow.
  • Large sites where pages are buried many clicks deep.
  • Poorly linked pages — orphaned URLs that nothing on your site points to.
  • Frequently updated content, where <lastmod> gives crawlers a reason to come back.

It does far less on a small, well-linked site that's already indexed. If your 20-page business site has clean navigation, the sitemap is a formality — worth having, not worth agonising over.

What goes inside sitemap.xml?

The format is deliberately minimal. A valid sitemap is UTF-8 encoded XML with a <urlset> root and one <url> entry per page:

<?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-05-14</lastmod>
  </url>
  <url>
    <loc>https://example.com/pricing</loc>
    <lastmod>2026-04-02</lastmod>
  </url>
</urlset>

Here's how the elements actually get treated:

Element Required What it's for How much engines rely on it
<loc> Yes The full absolute URL, including https:// Essential — this is the whole point of the file
<lastmod> No Date the content meaningfully changed Used as a recrawl hint, but only if it's honest
<changefreq> No Hint at update frequency Widely ignored by major engines
<priority> No Relative importance, 0.0–1.0 Ignored by Google; carries no ranking weight

Two limits are hard rules: 50,000 URLs and 50MB uncompressed per sitemap file. Past either, split into multiple sitemaps and list them in a sitemap index file — a wrapper using <sitemapindex> and <sitemap> tags that points at your individual sitemap files. Submit the index; engines follow it down.

One warning worth taking seriously: stamping <lastmod> with today's date on every URL each time you regenerate the file is a common auto-generated mistake. If the date never correlates with real changes, engines learn to distrust it. If your tool can't set it accurately, omit <lastmod> entirely.

Which URLs should be in a sitemap?

The rule: include only URLs you want indexed, that return 200 OK, and that are self-canonical — meaning the page's canonical tag points to itself, not somewhere else.

Leave out:

  • Redirects (3xx), error pages (4xx/5xx), and anything noindex.
  • URLs blocked in robots.txt — listing a blocked URL sends contradictory signals.
  • Non-canonical duplicates, faceted or filtered URLs, tracking-parameter variants.
  • Login pages, cart pages, thank-you pages, internal search results.

A sitemap full of redirects and dead URLs isn't neutral — it's noise that makes the file less trustworthy. A short accurate sitemap beats a long messy one.

How do I create a sitemap?

Pick the lightest option that fits your setup:

  1. Your CMS already does it. WordPress generates one at /wp-sitemap.xml out of the box; Shopify, Squarespace, Wix and Webflow all publish one automatically. SEO plugins like Yoast or Rank Math replace it with a configurable version. Check /sitemap.xml and /sitemap_index.xml in a browser before building anything.
  2. Your framework does it. Next.js, Astro, Hugo and Jekyll all have first-party sitemap support or a one-line plugin. Best option for custom sites — the file regenerates on every build, so it never drifts out of date.
  3. Use a crawler-based generator. Tools like Screaming Frog crawl your live site and export a sitemap. Fine for a static brochure site; the drawback is a snapshot you must remember to regenerate.
  4. Write it by hand. Reasonable under about 30 pages. Use the template above and keep it in version control.

Whichever route you take, open the finished file in a browser and confirm it loads as XML — not a 404, not an HTML error dressed up as success.

How do I submit my sitemap to search engines?

Submission is a one-time setup, not a recurring chore. Do these four things:

  1. Reference it in robots.txt. Add a line — Sitemap: https://example.com/sitemap.xml — using the full absolute URL. Any crawler that reads your robots file finds the sitemap, including engines you never registered with. This is the single highest-value step, and it takes 10 seconds.
  2. Submit in Google Search Console. Verify your property, open Sitemaps in the left menu, enter the path (sitemap.xml), and submit. Google will report a status of Success plus how many URLs it discovered.
  3. Submit in Bing Webmaster Tools. Same idea, and it covers Bing and its downstream partners. If you already have a verified Search Console property, Bing can import it directly.
  4. Stop there. Don't resubmit the same sitemap repeatedly, and don't pay a service to "submit your sitemap to 500 search engines." Those engines either don't exist, don't matter, or read your robots.txt anyway. Mass submission services are a relic of the early 2000s directory era and add nothing today — we go through why in the website submission guide.

When you update content, you don't need to resubmit. Engines refetch a submitted sitemap on their own schedule. If you want faster pickup of a specific URL, use URL Inspection → Request Indexing in Search Console for that single page, or push the URL via IndexNow, which Bing and Yandex support for near-instant notification of new and changed URLs. Neither is a substitute for a sitemap; they're complements.

How do I check my sitemap is working?

Watch three things in Search Console's Sitemaps report:

  • Status. Success means it was fetched and parsed. Couldn't fetch usually means a wrong path, a 404, or robots.txt blocking the sitemap file itself.
  • Discovered URLs. If this is far lower than your page count, the file is truncated or your generator is skipping pages.
  • Indexed vs submitted. Some gap is normal and expected. A large gap is a content and quality signal, not a sitemap bug — the sitemap did its job by getting the URLs discovered. The fuller diagnosis lives in our search engine indexing guide.

The mental model that keeps this straight: a sitemap is an invitation list, not a guest list. You control who's invited. The engine still decides who gets in.

FAQ

Do I need an XML sitemap for a small website?

Not strictly. If your site is small and every page is reachable through normal internal links, crawlers will find everything without one. But a sitemap costs nothing — most platforms generate it automatically — and it removes any doubt about discovery. Treat it as cheap insurance rather than a requirement, and spend your real effort on internal linking and page quality.

Will submitting a sitemap get my pages indexed faster?

Sometimes, and only for discovery. A sitemap can shorten the time before a crawler first finds a URL, which matters most on new sites with few inbound links. It has no influence on whether the page is then judged worth indexing. If pages are being crawled and skipped, a sitemap change won't fix it — the content, internal links, and site quality will.

Where should sitemap.xml be located?

The site root — https://example.com/sitemap.xml — is the convention and the safest choice, because a sitemap can only cover URLs at or below its own directory level. Use the exact protocol and hostname your site canonically uses. With several sitemaps, put a sitemap index file at the root.

What's the difference between an XML sitemap and an HTML sitemap?

An XML sitemap is a machine-readable file for crawlers, listing URLs and metadata; visitors never see it. An HTML sitemap is a normal page on your site listing links for humans to browse. They serve different audiences, and the HTML version has a side benefit: because it's a real page with real links, it also gives crawlers internal paths to pages that might otherwise be orphaned.

Does priority or changefreq affect my rankings?

No. Neither element carries ranking weight, and Google has stated it ignores priority outright while treating changefreq as, at best, a weak hint. Setting every page to priority 1.0 accomplishes nothing. The only sitemap element worth tuning is <lastmod>, and only if the dates reflect genuine content changes.

Next step

A sitemap is one of the few SEO tasks that's genuinely finished once you do it right: generate the file, keep it accurate, add the Sitemap: line to robots.txt, submit it once in Search Console and Bing Webmaster Tools, then leave it alone. Everything after that — whether those URLs get indexed and found — comes down to content worth indexing and links worth following. Once the crawlers can find your pages, make sure people can too: add your website to the ranking at addtopwebsite.com.

Comments are disabled for this article.