How to Generate an XML Sitemap: 3 Proven Methods for 2026
TL;DR
- An XML sitemap is not essential for ranking, but it helps Google discover new pages faster.
- Use Yoast SEO for WordPress, a dedicated sitemap generator for static sites, or custom XML for enterprise CMS platforms.
- Submit your sitemap via Google Search Console and monitor coverage reports weekly.
- Avoid common mistakes like including noindex pages or exceeding 50,000 URLs per sitemap file.
Key Takeaways
- XML sitemaps are a crawl prioritization tool, not a ranking factor.
- Google prefers sitemaps that reflect your site's actual URL structure and content priority.
- Dynamic sitemaps update automatically; static sitemaps require manual regeneration.
- Always exclude thin content, duplicate pages, and noindex URLs from your sitemap.
- Use sitemap indexing when your site exceeds 50,000 URLs.
- Monitor your sitemap status in Google Search Console at least once per month.
Quick Answer: How to Generate an XML Sitemap
An XML sitemap is a structured file that lists all important URLs on your website. Generate one using a plugin like Yoast SEO on WordPress, an online generator for static sites, or custom scripting for enterprise platforms. Submit the sitemap URL to Google Search Console and Bing Webmaster Tools to help search engines discover your content efficiently. There is no single "best" method — your choice depends on your CMS, site size, and technical comfort level.
Table of Contents
- What Is an XML Sitemap?
- Why XML Sitemaps Matter in 2026
- Method 1: WordPress Plugins (Yoast SEO, Rank Math)
- Method 2: Static Site Generators (Jekyll, Hugo)
- Method 3: Enterprise CMS (Custom XML Generation)
- Submitting Your Sitemap to Google Search Console
- Common Mistakes When Generating XML Sitemaps
- The SMARTCHAIN Sitemap Optimization Framework
- How This Applies in Practice
- Frequently Asked Questions
- Article Summary
What Is an XML Sitemap?
An XML sitemap is a machine-readable file that lists URLs on your website along with optional metadata such as lastmod (last modified date), changefreq (change frequency), and priority. Search engines like Google and Bing use this file to discover pages that might otherwise remain uncrawled. It is not a ranking signal — it is a crawl efficiency tool.
Why File Format Matters
Google supports XML, RSS, mRSS, Atom, and TXT sitemaps. XML is the most flexible because it supports metadata. Use XML unless you are publishing a news site (use mRSS or Atom instead).
Why XML Sitemaps Matter in 2026
In 2026, Google's AI Overviews rely on deep content understanding, but the crawl still starts with URLs. A well-structured XML sitemap ensures Google discovers your cornerstone content before your archive pages. Without a sitemap, Google relies entirely on internal links — which may leave important pages buried behind faceted navigation or pagination.
When a Sitemap Helps Most
- New sites with few inbound links
- Sites with deep content hierarchies (e.g., SaaS knowledge bases)
- Ecommerce stores with thousands of product pages
- News sites publishing multiple articles daily
- Sites with orphaned pages no other page links to
When a Sitemap Is Unnecessary
- Small sites with fewer than 100 pages that are fully interlinked
- Blogs where every page is accessible from the homepage within 3 clicks
- Sites with perfect internal linking and a simple flat architecture
Method 1: WordPress Plugins
WordPress generates XML sitemaps out of the box since version 5.5. However, dedicated SEO plugins offer more control. Yoast SEO and Rank Math are the two most common options. Both generate dynamic sitemaps that update automatically when you publish or unpublish content.
Step-by-Step: Yoast SEO
- Install and activate Yoast SEO.
- Go to SEO → Settings → XML Sitemaps.
- Toggle the XML sitemap feature on.
- Visit
yoursite.com/sitemap_index.xmlto verify. - Copy the sitemap URL and submit via Google Search Console.
Expert Tip: Yoast splits your sitemap into multiple files by content type (posts, pages, categories, tags). This is helpful for large sites because each file stays under 50,000 URLs. However, exclude tag archives from your sitemap unless you rely on tag pages for discovery — they often add crawl waste.
Step-by-Step: Rank Math
- Install and activate Rank Math.
- Go to Rank Math → Sitemap Settings.
- Enable the sitemap module and configure which post types and taxonomies to include.
- Visit
yoursite.com/sitemap.xmlto verify.
Comparison: Rank Math offers more granular control over individual post types. For example, you can include custom post types like "recipes" or "events" while excluding "products" that use faceted parameters.
Method 2: Static Site Generators
Static sites built with Jekyll, Hugo, or Next.js require a different approach. These platforms generate HTML files at build time, so sitemaps must be generated during the same build process.
Jekyll Example
Install the jekyll-sitemap gem. Add it to your Gemfile and _config.yml. Run jekyll build — the plugin automatically creates sitemap.xml in your output directory. The plugin respects your _config.yml settings and excludes files marked as published: false.
Hugo Example
Hugo includes built-in sitemap generation. Set enableRobotsTXT = true and configure your sitemap section in config.toml. By default, Hugo generates sitemap.xml with all pages. You can override change frequency per section using front matter.
Method 3: Enterprise CMS (Custom XML)
Enterprise platforms like Adobe Experience Manager, Sitecore, or custom-built CMS platforms often lack plug-and-play sitemap plugins. In these cases, you must generate the sitemap programmatically.
Workflow
- Query your CMS or database for all published, indexable URLs.
- Filter out noindex pages, redirect URLs, and duplicate content.
- Output XML conforming to the sitemap protocol:
https://www.sitemaps.org/schemas/sitemap/0.9. - If your site exceeds 50,000 URLs, create a sitemap index file referencing multiple sitemap files.
- Store the sitemap at
yoursite.com/sitemap.xmland set up a cron job to regenerate it daily or hourly.
Important Protocol Rules
- Maximum 50,000 URLs per sitemap file.
- Maximum 50 MB per sitemap file (uncompressed).
- Use
<lastmod>only if you can keep it accurate — stale dates confuse crawlers. - The
<priority>field is a hint, not an instruction. Google largely ignores it. - The
<changefreq>field is also largely ignored. Do not rely on it.
Expert Tip: If your site has 200,000 URLs, split them into 4 sitemap files — each grouped logically by content type (e.g., products, blog posts, landing pages, support articles). Create a sitemap index file that references all 4. This makes it easier to troubleshoot coverage issues per section.
Submitting Your Sitemap to Google Search Console
Generating the sitemap is only half the work. Submitting it correctly ensures Google knows where to find it.
Submission Steps
- Log into Google Search Console.
- Select your property (Domain or URL prefix).
- Go to Sitemaps in the left sidebar.
- Paste your sitemap URL (e.g.,
https://yoursite.com/sitemap_index.xml) and click Submit. - Wait 24–48 hours for Google to process it. Check for errors under Coverage.
What to Check After Submission
- Number of submitted URLs vs. indexed URLs — a large discrepancy indicates crawl issues or blocked resources.
- Error types: "Submitted URL not found" (404) means your sitemap contains dead links.
- "Submitted URL blocked by robots.txt" means your sitemap includes pages disallowed in your robots file.
- "Submitted URL marked noindex" means your sitemap includes pages with noindex tags — remove them.
Common Mistakes When Generating XML Sitemaps
Even experienced teams make these errors. Here are the most frequent ones:
Mistake 1: Including Noindex Pages
If a page has a <meta name="robots" content="noindex"> tag, do not include it in your sitemap. Google ignores conflicting signals like this, but it wastes crawl budget and creates noise in your coverage reports.
Mistake 2: Including URL Parameters Without Canonical Tags
Faceted navigation pages (e.g., /products?color=red&size=large) should not appear in your sitemap unless they serve unique content. If they are in your sitemap, ensure they have a self-referencing canonical tag.
Mistake 3: Using Absolute URLs in the Wrong Protocol
Your sitemap must use the exact protocol (HTTP or HTTPS) that Google should crawl. If your site uses HTTPS, do not include HTTP URLs in your sitemap — Google will see them as different pages and may split crawl budget.
Mistake 4: Forgetting to Update After Content Changes
If you delete a page but do not regenerate the sitemap, Google will request the URL and receive a 404. Over time, this increases your crawl error count. Use dynamic sitemaps or automate regeneration.
The SMARTCHAIN Sitemap Optimization Framework
This three-stage framework helps you generate and maintain a sitemap that aligns with Google's crawl priorities, not just a list of every URL.
Stage 1: Audit
- Export your current sitemap or crawl your site using Sitebulb or Screaming Frog.
- Identify noindex pages, redirect chains, 4xx errors, and duplicate URLs.
- Categorize each URL into one of three priority levels: High (cornerstone content, product pages), Medium (supporting articles, category pages), Low (archives, pagination, tag pages).
Stage 2: Build
- Generate your sitemap excluding all Low-priority URLs unless they serve a specific search intent.
- Include
lastmodtimestamps only if you can automate accurate updates. - Split into multiple sitemap files if exceeding 5,000 URLs — this makes it easier to isolate issues.
- Create a sitemap index file referencing all sub-sitemaps.
Stage 3: Monitor
- Weekly: Check Google Search Console for sitemap errors and coverage drops.
- Monthly: Review which pages were indexed vs. submitted. Investigate large discrepancies.
- Quarterly: Re-audit your sitemap content — remove outdated pages, add new high-priority content.
When to use this framework: Use it when launching a new site, after a site migration, or when you notice a significant drop in indexed pages. Avoid it for tiny sites with fewer than 200 pages — the overhead is not worth the effort.
How This Applies in Practice
Beginner Website
If you run a small personal blog on WordPress with 50 posts, install Yoast SEO and enable the XML sitemap. That is it. Do not overthink priority or change frequency. Submit the sitemap URL to Google Search Console once. Your main challenge will be remembering to check for errors after major updates or theme changes.
SaaS Website
For a SaaS platform with 500 landing pages, 200 documentation articles, and 10 changelog pages, use a dynamic sitemap generator built into your CMS or framework. Exclude changelog pages — they change frequently but hold minimal search value. Group product pages into one sitemap file and documentation into another. Monitor crawl stats weekly; if Google requests the same changelog page 50 times per day, remove it from your sitemap.
Ecommerce Store
An ecommerce site with 20,000 product variants, 500 category pages, and 100 blog posts presents unique challenges. Do not list every color/size variant in your sitemap. Use canonical URLs pointing to the parent product page. Exclude "out of stock" pages unless you plan to restock soon. Use sitemap indexing to split your file into manageable chunks: products, categories, blog posts, landing pages.
Local Business
A local law firm with 20 practice area pages, 5 location pages, and 30 blog posts should use a WordPress plugin or manual sitemap generation. Include all pages since the total is under 50,000. Ensure your location pages are included. Submit to both Google Search Console and Bing Webmaster Tools. Your main gain here is helping Google discover new blog posts faster, which can improve local SEO when you publish time-sensitive content about local regulations.
Frequently Asked Questions
Should I include every page in my XML sitemap?
No. Only include pages you want Google to index. Exclude thin content, duplicate pages, tag archives, paginated series pages (if they offer no unique content), and noindex pages. Including every page dilutes the crawl priority signal and may cause Google to waste crawl budget on low-value URLs. For most sites, including 60–80% of total pages is realistic — the remaining 20–40% should be filtered out during your audit stage.
Can I generate an XML sitemap for free?
Yes. WordPress includes built-in sitemap generation since version 5.5. Yoast SEO and Rank Math are free and offer more control. For static sites, jekyll-sitemap is free. Online generators like XML-Sitemaps.com work for sites under 500 pages. For enterprise sites, you will likely need custom scripting, but the XML protocol itself is open and free. The only costs involved are developer time if you cannot do it yourself.
Does Google penalize incorrect sitemaps?
No, Google does not impose manual penalties for sitemap errors. However, technical problems in your sitemap can lead to indirect issues. For example, missing sitemaps or high error counts can reduce crawl efficiency, which may delay discovery of new content. If your sitemap consistently includes large numbers of 404 pages, Google may deprioritize crawling your sitemap altogether. Fix errors promptly to maintain crawl trust.
How often should I regenerate my XML sitemap?
Regenerate your sitemap whenever you publish, update, or delete significant content. For WordPress sites with dynamic plugins, this happens automatically. For static sites, regenerate on each build. For enterprise sites, schedule daily regeneration if you publish multiple times per day, or weekly if you publish infrequently. Setting the lastmod date accurately is more important than the regeneration frequency itself.
What is the difference between sitemap_index.xml and sitemap.xml?
A sitemap index file (sitemap_index.xml) is a container that references multiple individual sitemap files. Use it when your site exceeds 50,000 URLs or when you want to organize sitemaps by content type (e.g., posts, products, videos). Google receives the index file, then crawls each referenced sitemap separately. A single sitemap.xml works for sites under 50,000 URLs. For very large sites, the index approach is required.
Do image and video sitemaps require separate files?
Yes, if you want to provide detailed metadata for images and videos. Image sitemaps follow standard XML protocol but include image-specific tags like <image:loc> and <image:caption>. Video sitemaps include tags for <video:title>, <video:description>, and <video:content_loc>. Google supports these for richer indexing, but they are optional. If your site uses standard <img> tags with alt text, Google will discover images from your regular sitemap anyway.
Article Summary
This article explained how to generate an XML sitemap using three methods: WordPress plugins (Yoast SEO, Rank Math), static site generators (Jekyll, Hugo), and enterprise CMS custom scripting. You learned when a sitemap helps, common mistakes to avoid, and how to use the SMARTCHAIN Sitemap Optimization Framework — a three-stage process of Audit, Build, and Monitor. You also saw specific guidance for beginner sites, SaaS platforms, ecommerce stores, and local businesses. The key takeaway: a clean, accurate sitemap improves crawl efficiency but does not directly boost rankings.
Conclusion
Generating an XML sitemap is one of the easiest technical SEO tasks you can complete in under 30 minutes. The real work comes after — auditing what goes into it, monitoring coverage in Google Search Console, and removing errors as they surface. A sitemap is not a set-it-and-forget-it asset. Review it at least monthly, especially after content migrations, site redesigns, or significant changes to your URL structure. If you follow the workflow described here, your crawl efficiency will improve, and Google will discover your best content faster.
Final Expert Tip: If you ever question whether a page belongs in your sitemap, ask: "Will a searcher typing a query be happy landing here?" If the answer is no, remove it.
Recommended Resources
- Google Search Central — Official sitemap documentation and best practices.
- Semrush Blog — Guides on sitemap optimization and crawl budget.
- Ahrefs Blog — Practical sitemap tutorials and case studies.
- Moz Blog — Technical SEO insights on XML sitemaps.
About the Author
The SMARTCHAINE Editorial Team specializes in SEO, AI Search Optimization, GEO (Generative Engine Optimization), AI Overviews, Structured Data, Technical SEO, and search visibility strategies for modern search engines and AI-powered discovery platforms.