Skip to content
SEO

XML Sitemap: Complete Guide to Better Indexing and Crawl Efficiency

Learn how XML sitemaps work, how to create them, submit them to Google, and avoid the most common mistakes that slow indexing.

XML sitemaps are like a map you hand to search engines — they tell exactly which pages exist, when they were last updated, and how important they are relative to each other. For smaller websites with good internal linking, a sitemap is a bonus. For large websites with thousands of pages, it is a necessity. Here is everything you need to know to use sitemaps correctly.

What XML sitemaps are and why they matter

An XML sitemap is a structured file in XML format that lists the URLs on your website, along with metadata about each URL. It helps search engines discover pages they might not otherwise find through regular crawling of internal links.

Google has stated that sitemaps are especially important for new websites with few inbound links, large websites with over 500 pages, websites with rich media content, and websites with pages that are not well internally linked (Google Search Central, "Sitemaps Overview," 2025).

A common misconception is that a sitemap guarantees indexing. It does not. A sitemap is a request — it asks Google to look at the URLs, but Google decides whether they are worth indexing based on content quality, authority, and other factors.

Sitemap vs robots.txt: The difference you must understand

Robots.txt and sitemaps are two sides of the same coin, but they do entirely different things. Robots.txt tells crawlers what NOT to visit. Sitemaps tell crawlers what they SHOULD visit. The two files should be used together to give search engines a clear picture of your website.

An important rule: Never include URLs in the sitemap that are blocked in robots.txt. It sends conflicting signals to Google and can create confusion in the indexing process. Ensure your sitemap only contains URLs that are actually accessible for crawling and indexing.

Read our robots.txt guide for a complete overview of crawl management, and see the technical SEO checklist for how these elements connect.

Sitemap structure: loc, lastmod, changefreq, and priority

Each element in the sitemap can contain four fields. Of these, only loc (the URL) is required, but the others provide useful additional information.

loc is the complete URL of the page. lastmod is the date the page was last modified — and this is important: use the actual modification date, not today's date. Google uses lastmod to determine whether a page should be re-crawled. If you update lastmod without real changes, Google will eventually ignore lastmod across your entire website.

changefreq (how often the page changes) and priority (0.0-1.0, relative importance) are largely ignored by Google in 2026. Google has stated they use their own signals to determine crawl frequency. You can include them, but they have minimal practical effect.

  • loc — required, complete URL of the page
  • lastmod — recommended, actual last modification date (ISO 8601)
  • changefreq — optional, ignored by Google (daily, weekly, monthly, etc.)
  • priority — optional, ignored by Google (0.0 to 1.0)

Sitemap types: Standard, image, video, and news

Standard XML sitemaps cover regular web pages. But Google also supports specialized sitemaps for different content types that can provide better visibility in specific search verticals.

Image Sitemap helps Google discover images that might not be found through regular crawling — for example, images loaded via JavaScript. Video Sitemap provides detailed metadata about video content (title, description, duration, thumbnail) and increases the chance of appearing in video search.

News Sitemap is for websites approved in Google News. It contains only articles from the last 48 hours and has extra fields like publication_date and language. For e-commerce sites, it is especially useful to use image sitemaps for product images.

Generating sitemaps: Tools and CMS plugins

Most CMSes and frameworks have built-in or plugin-based support for sitemap generation. In WordPress, Yoast SEO and Rank Math are the most popular options. Both generate sitemaps automatically and update them when you publish new content.

In Next.js, you can generate sitemaps dynamically with the next-sitemap package or by building a custom API route. For e-commerce platforms like Shopify, sitemaps are generated automatically, but you have limited control over the structure.

For large or complex websites, it may be worth building the sitemap manually or semi-automatically with a script. It gives full control over which URLs are included and lets you segment the sitemap by content type. Need help with technical SEO and sitemap setup? Contact LeapJet — we have experience with everything from simple business sites to e-commerce stores with hundreds of thousands of products.

Size limits and sitemap index files

A single sitemap can contain a maximum of 50,000 URLs and must not exceed 50 MB uncompressed. For most websites, this is more than enough. But for large e-commerce stores, media sites, and directories, you need a sitemap index file.

A sitemap index is a sitemap that points to other sitemaps. It can contain up to 50,000 sitemap references, giving a theoretical limit of 2.5 billion URLs. In practice, you should segment sitemaps by content type or category — one sitemap for products, one for category pages, one for blog posts, etc.

Gzip compression is recommended for large sitemaps. It reduces file size dramatically and means your server uses fewer resources serving the file to crawlers.

Submitting to Google Search Console

You can submit your sitemap to Google in three ways: via Google Search Console, via a ping URL, or via robots.txt. Google Search Console is the most reliable option because you get feedback on any errors.

In GSC, go to "Sitemaps" in the left menu, enter your sitemap URL, and click "Submit." Google will then crawl the sitemap and report status — including the number of URLs discovered, the number indexed, and any errors.

Check the sitemap in GSC regularly. Common warnings include URLs returning 404, URLs blocked by robots.txt, and URLs with a noindex tag. All of these should be removed from the sitemap. Read our Google Search Console guide for a complete walkthrough of the tool.

Dynamic sitemaps for e-commerce

E-commerce stores have unique challenges with sitemaps. Products are added and removed continuously, prices change, and seasonal items come and go. A static sitemap will quickly become outdated.

The solution is dynamic generation — a script that builds the sitemap from your product database on each call or on a schedule (daily is common). Include only products that are in stock and active. Remove products that are discontinued or permanently out of stock.

For large e-commerce stores with hundreds of thousands of products, you should segment the product sitemap by category. It makes troubleshooting easier and lets you identify indexing problems faster. See our e-commerce SEO guide for more e-commerce-specific tips.

Best practices and common mistakes

The most important rule is simple: the sitemap should only contain canonical URLs that return a 200 status code and that you actually want in Google's index. Everything else is noise that can confuse crawlers and waste crawl budget.

Common mistakes include: URLs with redirects (301/302) in the sitemap, URLs with noindex, URLs blocked in robots.txt, URLs with incorrect canonicals, and outdated lastmod dates. All of these problems are reported in Google Search Console if you submit the sitemap there.

  • Include only canonical URLs with 200 status code
  • Update lastmod only when content actually changes
  • Remove URLs with redirects, noindex, or robots.txt blocking
  • Segment large sitemaps by content type
  • Use gzip compression for sitemaps over 10 MB
  • Reference the sitemap in robots.txt with the Sitemap directive
  • Submit via Google Search Console for error reporting
  • Check GSC reports monthly for new errors

Sources

Google Search Central, "Sitemaps Overview," 2025. Google Search Central, "Build and Submit a Sitemap," 2025. Sitemaps.org, "XML Sitemap Protocol," 2024. Screaming Frog, "Sitemap Audit Best Practices," 2025. Ahrefs, "Sitemap SEO Study," 2024.

New articles, by email

Our latest practical articles on search, ads and analytics, gathered once a month. No sales sequences.

One email a month, no spam. Unsubscribe any time.