ToolPopToolPop
Back to BlogGuides

XML Sitemaps: The Definitive Guide to Creating and Submitting Sitemaps for SEO

XML sitemaps help search engines discover and index your pages efficiently. Learn how to create perfect sitemaps that boost your SEO.

ToolPop TeamFebruary 28, 202516 min read

What Is an XML Sitemap?

An XML sitemap is a file that lists all the important pages on your website in a format that search engines can easily read and process. Think of it as a roadmap that helps search engine crawlers navigate your site efficiently.

While search engines can discover pages by following links, sitemaps provide additional benefits:

  • Faster discovery of new and updated content
  • Prioritization signals to indicate page importance
  • Metadata about when pages were last modified
  • Coverage information for video, image, and news content

The Importance of Sitemaps for SEO

For Large Websites: Sites with thousands of pages benefit most from sitemaps. Crawlers might not reach every page through internal links alone.

For New Websites: Fresh domains without many external links need sitemaps to ensure content gets discovered.

For Deep Content: Pages that require many clicks to reach may not get crawled frequently without sitemap inclusion.

For Rich Media: Video and image sitemaps provide specific metadata that helps these assets appear in specialized search results.

XML Sitemap Structure

Basic Sitemap Format

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/page-1/</loc>
    <lastmod>2025-03-01</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.8</priority>
  </url>
  <url>
    <loc>https://example.com/page-2/</loc>
    <lastmod>2025-02-15</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.6</priority>
  </url>
</urlset>

Required Elements

: The root element containing all URL entries. Must include the namespace declaration.

: Container for each individual page entry.

: The full URL of the page. This is the only required element within .

Optional Elements

: The date when the page was last modified. Use ISO 8601 format (YYYY-MM-DD).

: How often the page is likely to change:

  • always
  • hourly
  • daily
  • weekly
  • monthly
  • yearly
  • never
: Relative importance within your site (0.0 to 1.0). Default is 0.5.

Important Notes on Optional Elements

Google has stated it largely ignores and . The date is useful if it accurately reflects when content actually changed.

Best Practice: Focus on and accurate dates. Don't waste time optimizing changefreq and priority.

Types of Sitemaps

Standard URL Sitemap

The basic sitemap format for HTML pages.

Image Sitemap

Helps Google discover and index images, especially important for image-heavy sites.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
  <url>
    <loc>https://example.com/product-page/</loc>
    <image:image>
      <image:loc>https://example.com/images/product-1.jpg</image:loc>
      <image:title>Product Name</image:title>
      <image:caption>Description of the product image</image:caption>
    </image:image>
    <image:image>
      <image:loc>https://example.com/images/product-2.jpg</image:loc>
    </image:image>
  </url>
</urlset>

Video Sitemap

Provides detailed metadata for video content.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
  <url>
    <loc>https://example.com/video-page/</loc>
    <video:video>
      <video:thumbnail_loc>https://example.com/thumbs/video1.jpg</video:thumbnail_loc>
      <video:title>Video Title</video:title>
      <video:description>Description of the video content</video:description>
      <video:content_loc>https://example.com/videos/video1.mp4</video:content_loc>
      <video:duration>600</video:duration>
      <video:publication_date>2025-03-01T12:00:00+00:00</video:publication_date>
    </video:video>
  </url>
</urlset>

News Sitemap

Required for Google News inclusion.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
  <url>
    <loc>https://example.com/news/breaking-story/</loc>
    <news:news>
      <news:publication>
        <news:name>Example News</news:name>
        <news:language>en</news:language>
      </news:publication>
      <news:publication_date>2025-03-15T12:00:00+00:00</news:publication_date>
      <news:title>Breaking Story Headline</news:title>
    </news:news>
  </url>
</urlset>

Sitemap Index Files

For sites with more than 50,000 URLs or sitemaps larger than 50MB, use a sitemap index file to organize multiple sitemaps.

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://example.com/sitemap-pages.xml</loc>
    <lastmod>2025-03-15</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemap-posts.xml</loc>
    <lastmod>2025-03-14</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemap-products.xml</loc>
    <lastmod>2025-03-12</lastmod>
  </sitemap>
</sitemapindex>

Organizing Multiple Sitemaps

By Content Type:

  • sitemap-pages.xml (static pages)
  • sitemap-posts.xml (blog posts)
  • sitemap-products.xml (e-commerce products)
  • sitemap-categories.xml (category pages)
By Date/Archive:
  • sitemap-2025.xml
  • sitemap-2024.xml
  • sitemap-2023.xml
By Language/Region:
  • sitemap-en.xml
  • sitemap-es.xml
  • sitemap-de.xml

Creating Your Sitemap

Manual Creation

For small sites, you can create sitemaps manually using any text editor. Just follow the XML format and validate your file.

CMS Plugins

WordPress:

  • Yoast SEO (automatic)
  • Rank Math (automatic)
  • XML Sitemaps plugin
Shopify:
  • Built-in sitemap generation at /sitemap.xml
Next.js:
  • next-sitemap package
  • Custom generateSitemap function

Online Generators

Tools like ToolPop's Sitemap Generator can crawl your site and generate a sitemap automatically.

Programmatic Generation

For dynamic sites, generate sitemaps programmatically:

// Example: Generating sitemap in Next.js
export async function generateSitemap() {
  const pages = await getAllPages();

  const sitemap = \`<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  \${pages.map(page => \`
  <url>
    <loc>\${page.url}</loc>
    <lastmod>\${page.updatedAt}</lastmod>
  </url>\`).join('')}
</urlset>\`;

  return sitemap;
}

Sitemap Best Practices

What to Include

Include:

  • All important, indexable pages
  • Pages that are difficult to discover through links
  • Recently added or updated content
  • Pages with valuable, unique content
Exclude:
  • Pages with noindex directives
  • Duplicate content
  • Thin or low-quality pages
  • Error pages (404, 500)
  • Paginated archives (debatable)
  • Parameter variations
  • Private/admin pages

URL Consistency

Ensure sitemap URLs match your site's canonical URLs:

  • Consistent protocol (https vs http)
  • Consistent www vs non-www
  • Correct trailing slashes
  • Lowercase URLs (if that's your standard)
Wrong:
<loc>http://www.example.com/Page/</loc>  <!-- Site uses https, no www -->

Right:

<loc>https://example.com/page/</loc>

Accurate Last Modified Dates

Only update when the page content actually changes meaningfully. Don't update it for:

  • Minor typo fixes
  • Layout changes
  • Unrelated site-wide updates
Search engines may lose trust in your lastmod dates if they don't reflect actual content changes.

Keep Sitemaps Fresh

  • Update sitemaps when content changes
  • Remove deleted pages
  • Add new pages promptly
  • Monitor for errors in Search Console

Submitting Your Sitemap

Method 1: Search Console (Recommended)

Google Search Console:

  • Navigate to Sitemaps in the left menu
  • Enter your sitemap URL
  • Click Submit
  • Monitor for errors and indexing status
Bing Webmaster Tools:
  • Go to Sitemaps section
  • Enter sitemap URL
  • Submit

Method 2: Robots.txt

Add the sitemap location to your robots.txt file:

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

Method 3: IndexNow

For Bing, Yandex, and supporting engines, use IndexNow for instant notification of new content.

Method 4: Ping Endpoints

Historically, you could ping search engines directly. Google deprecated this in 2023, but Bing still supports it:

https://www.bing.com/ping?sitemap=https://example.com/sitemap.xml

Common Sitemap Errors

Error 1: Invalid XML Format

Ensure proper encoding, valid structure, and escaped special characters.

Characters requiring escape:

  • & becomes &
  • < becomes <
  • > becomes >
  • " becomes "
  • ' becomes '

Error 2: URL Mismatches

Sitemap URLs must be on the same domain (or subdomains) as the sitemap file itself.

Error 3: Including Noindex Pages

Don't include pages that have noindex directives. This sends conflicting signals.

Error 4: Broken URLs

Regularly audit your sitemap to remove URLs that return 404 or redirect.

Error 5: Exceeding Limits

  • Maximum 50,000 URLs per sitemap
  • Maximum 50MB file size (uncompressed)
Use sitemap index files for larger sites.

Monitoring Sitemap Performance

Google Search Console Metrics

Track these metrics for your submitted sitemaps:

  • Submitted URLs: Total URLs in your sitemap
  • Indexed URLs: URLs Google has indexed
  • Errors: Issues preventing indexing
  • Warnings: Non-critical issues

Identifying Issues

If you see low indexing rates:

  • Check for crawl errors
  • Review page quality
  • Verify canonical tags
  • Ensure pages aren't blocked
  • Check for noindex tags

Regular Audits

Schedule monthly sitemap audits:

  • Verify all URLs return 200 status
  • Confirm indexable pages are included
  • Check for duplicate entries
  • Validate XML format
  • Review Search Console reports

Advanced Sitemap Strategies

Hreflang Sitemaps

For international sites, include hreflang annotations:

<url>
  <loc>https://example.com/page/</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/page/"/>
  <xhtml:link rel="alternate" hreflang="es" href="https://example.es/pagina/"/>
  <xhtml:link rel="alternate" hreflang="de" href="https://example.de/seite/"/>
</url>

Dynamic Sitemap Updates

For large, frequently updated sites, implement real-time sitemap generation:

  • Generate sitemaps on-demand or cache them
  • Update when content changes
  • Use webhooks to trigger regeneration

Sitemap Analytics

Track which sitemap URLs get indexed and how quickly:

  • Submit separate sitemaps for different content types
  • Monitor indexing speed for each
  • Identify patterns in indexing success

Using ToolPop's Sitemap Generator

Our free Sitemap Generator helps create valid XML sitemaps:

  • Enter your website URL
  • Choose crawl depth and settings
  • Review discovered URLs
  • Export formatted XML sitemap
  • Submit to search engines
Features include:
  • Automatic URL discovery
  • Duplicate detection
  • Validation checks
  • Multiple format exports
  • Sitemap index generation

Conclusion

XML sitemaps remain an essential tool for technical SEO. While they don't guarantee indexing or rankings, they help search engines discover and understand your content efficiently.

Key takeaways:

  • Include all important, indexable pages
  • Keep URLs consistent with canonical versions
  • Use accurate lastmod dates
  • Submit through Search Console
  • Monitor indexing status regularly
  • Use sitemap index files for large sites
Start with our free Sitemap Generator to create a properly formatted sitemap for your website, then submit it to Google and Bing for optimal crawl coverage.

Tags
XML sitemapsitemap SEOsitemap generatorGoogle sitemapsitemap.xmlsitemap submissionsearch indexingcrawl optimization
Share this article

Try Our Free Tools

Put these tips into practice with our free online tools. No signup required.

Explore Tools