XML Sitemaps: How to Create One and Submit It to Google

What an XML sitemap is, what to include and leave out, size limits, how to submit it in Google Search Console and how to fix common sitemap errors.

An XML sitemap is a file that lists the pages on your website you want search engines to find. It doesn't guarantee indexing, but it helps Google discover new and updated pages faster, especially on large sites or sites with few external links.

What a sitemap looks like

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://yourbusiness.lk/services/local-seo</loc>
    <lastmod>2026-10-01</lastmod>
  </url>
</urlset>

Each <url> entry has the page address and, optionally, when it was last meaningfully changed.

What to include

Only URLs that are:

  • Live, returning a 200 status
  • Indexable, without a noindex tag
  • Canonical, the preferred version of the page
  • Useful, pages you actually want people to find from search

What to leave out

  • Redirected URLs
  • 404 or error pages
  • Pages with noindex
  • Duplicate versions with parameters, such as ?sort=price
  • Admin, cart, checkout and account pages
  • Thin tag or archive pages you don't want indexed

A sitemap full of junk URLs sends mixed signals and wastes crawling.

Limits

  • 50,000 URLs or 50 MB uncompressed per sitemap file
  • For larger sites, split into several sitemaps and list them in a sitemap index file

About lastmod, priority and changefreq

  • lastmod: Google uses it if it's consistently accurate. Only update it when content really changes.
  • priority and changefreq: Google ignores these. They don't hurt, but they don't help.

How to create a sitemap

  • WordPress: WordPress creates a basic sitemap at /wp-sitemap.xml. SEO plugins such as Yoast or Rank Math create their own, usually at /sitemap_index.xml. Use one, not both.
  • Shopify: created automatically at /sitemap.xml.
  • Custom sites: generate it from your database, so it updates automatically when pages are added. This site's sitemap is generated that way.

Submit it to Google

  1. Open Google Search Console for your site.
  2. Go to Sitemaps.
  3. Enter the sitemap URL and click Submit.
  4. Check back for its status and the number of discovered URLs.

Also add a Sitemap: line to your robots.txt, so other search engines find it.

Common sitemap errors

  • Couldn't fetch: the URL is wrong, blocked or returns an error.
  • Submitted URL has noindex: remove the URL from the sitemap or remove the noindex.
  • Submitted URL is a redirect: list the final URL instead.
  • Many submitted pages not indexed: usually a quality or duplication issue, not a sitemap issue. See fixing indexing issues in Search Console.

Check yours

Our free SEO health check looks for your sitemap and robots.txt automatically. For a full review of crawling and indexing, see our technical SEO service.

Prabath Thalangama

SEO consultant and tech lead in Colombo. Google Analytics, Kubernetes (CKA), AWS and Red Hat certified.

Want this done for your site?

Get a free SEO audit with a written summary in 3 working days.

Get a free audit
WhatsAppFree audit