SEOMar 31, 2026 Β· Updated Oct 13, 2026 Β· 3 min read

How to Generate an XML Sitemap for SEO

An XML sitemap is a structured list of every page on your site that you want search engines to crawl and index. It tells crawlers what exists, when it was last modified, and how important each page is relative to others. While Google can discover pages through links, a sitemap ensures nothing is missed β€” especially on new or large sites.

πŸ—ΊοΈ
Try the Sitemap Generator
Free, no signup
β†’
DG
Derek Giordano
Designer & Developer
In this guide
01Sitemap XML Structure02Priority and Change Frequency: Skip Them03Submitting to Search Engines04Worked Example: Our Own Sitemap in Search Console05Dynamic vs Static Sitemaps

Sitemap XML Structure

A sitemap is a simple XML file:

<?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-04-15</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
</urlset>

Each <url> entry needs only <loc>, the page's full URL. <lastmod> is optional and worth including when it is accurate. <changefreq> and <priority> are in the sitemaps.org protocol, but Google's documentation says plainly that it ignores both, and it uses <lastmod> only when the value is consistently and verifiably accurate β€” reflecting a significant change to the content, not a footer date or a rebuild.

Priority and Change Frequency: Skip Them

Because Google ignores <priority> and <changefreq>, time spent tuning them (homepage 1.0, posts 0.6…) buys nothing in Google Search. Put the effort into <lastmod> instead: set it to the date the page content last changed in a meaningful way and keep it in step with the page's own visible or structured-data date. Bing has published the same advice, describing lastmod as the key signal for when to recrawl. On this site, a build check fails if any sitemap lastmod disagrees with the page's dateModified.

Submitting to Search Engines

Reference your sitemap in robots.txt:

Sitemap: https://example.com/sitemap.xml

Then submit it directly in Google Search Console (Sitemaps section) and Bing Webmaster Tools. After submission, monitor the coverage report β€” it shows how many URLs were discovered, crawled, and indexed, plus any errors. Resubmit when you add significant new content.

Worked Example: Our Own Sitemap in Search Console

Here is what Google Search Console reported for this site's sitemap on October 13, 2026 (read through the Search Console API):

FieldValue
URLs submitted785
Errors / warnings0 / 0
Last resubmittedOctober 12, 2026 β€” still "pending" a day later
Last downloaded by GoogleOctober 6, 2026
URLs actually indexed (URL Inspection of every page)469 of 783

Two lessons. Resubmitting asks Google to fetch the file, but on Google's schedule β€” a day later it had not. And a clean sitemap does not make pages indexed: about 40% of the URLs we listed were crawled or discovered but not indexed, which Google decides from the pages themselves. A sitemap helps discovery; content quality decides indexing.

Dynamic vs Static Sitemaps

Static sites can use a manually generated sitemap β€” the Sitemap Generator tool creates one from a URL list. Dynamic sites (CMS, e-commerce) should generate sitemaps programmatically on each build or via a route that generates XML on the fly. For sites with more than 50,000 URLs, use a sitemap index file that references multiple sitemap files β€” each limited to 50,000 URLs or 50MB.

Frequently Asked Questions

What is an XML sitemap?+
An XML sitemap is a file that lists all the URLs on your site that you want search engines to discover and index. It includes metadata like last modification date and priority.
Do I need a sitemap for SEO?+
Sitemaps are especially important for new sites (few inbound links for discovery), large sites (ensures all pages are found), and sites with deep or isolated pages. Small sites with good internal linking may not strictly need one, but it never hurts.
How do I submit a sitemap to Google?+
Add a Sitemap: directive to your robots.txt file, and submit the URL directly in Google Search Console under the Sitemaps section.
Try it yourself

Use the Sitemap Generator β€” free, no signup required.

⚑ Open Sitemap Generator
DG
Derek Giordano
Written by the creator of Ultimate Design Tools. BA in Business Marketing.