Skip to content
GigAI Tools
7 steps

How to Generate an XML Sitemap (and Submit It)

Build a valid XML sitemap for your site, add it to robots.txt, and submit it to Google Search Console so every page gets discovered. A clear step-by-step guide.

An XML sitemap is a machine-readable list of the URLs on your site that you want search engines to crawl and index. It doesn't guarantee indexing, but it gives crawlers a complete map of your pages, invaluable for large sites, new sites with few backlinks, and pages that aren't well linked internally.

You don't need a plugin or CMS to make one. A sitemap is just a specific XML format any tool can produce. This guide walks through generating a valid sitemap, hosting it at the right URL, pointing robots.txt at it, and submitting it to Google Search Console so your pages get discovered faster.

This guide uses XML Sitemap Generator

Free, private and instant. Open it now and follow along with the steps below.

Open XML Sitemap Generator

Follow these steps

  1. Step 1: Gather the URLs you want indexed

    Collect the canonical, public URLs you want search engines to crawl, skip admin pages, duplicate parameter URLs, and anything set to noindex. Include only pages that return a 200 status.

  2. Step 2: Generate the sitemap

    Open the XML sitemap generator, add your URLs, and let it build a valid <urlset> document. Each entry gets a <loc>, and you can add optional <lastmod>, <changefreq> and <priority> hints.

  3. Step 3: Set accurate lastmod dates

    Where you can, give each URL a truthful last-modified date. Google largely ignores changefreq and priority but does use a reliable lastmod to prioritise recrawling changed pages, so keep it honest.

  4. Step 4: Save the file as sitemap.xml

    Download the generated file and name it sitemap.xml. If you have more than 50,000 URLs or the file exceeds 50 MB uncompressed, split it into multiple sitemaps and list them in a sitemap index.

  5. Step 5: Upload it to your site root

    Place the file at the root of your domain so it's reachable at https://yourdomain.com/sitemap.xml. Load that URL in a browser to confirm it serves valid XML with a 200 status.

  6. Step 6: Reference it in robots.txt

    Add a line like 'Sitemap: https://yourdomain.com/sitemap.xml' to your robots.txt file. This lets any crawler discover the sitemap automatically without you submitting it manually.

  7. Step 7: Submit it in Google Search Console

    In Search Console, open the Sitemaps report, enter the sitemap URL and submit it. Google will fetch it, report how many URLs it read, and flag any parsing errors.

Tips & best practices

  • Only include canonical URLs: listing both a page and its duplicate sends mixed signals about which version to index.
  • Keep the sitemap in sync with your site: remove URLs that now 404 or redirect, since a sitemap full of dead links erodes crawler trust.
  • Use absolute URLs with the correct protocol (https) and host, relative paths aren't valid in a sitemap.
  • For very large or frequently changing sites, automate sitemap generation so it always reflects the current set of live pages.

Frequently asked questions