Skip to main content
Beta: Front-End Checklist is currently in beta. Some issues are still being fixed. Thanks for your patience.
SEOHigh

Create and submit an XML sitemap

An XML sitemap is available at /sitemap.xml and includes all important pages.

Utilities
Quick take
Typical fix time 15 min
  • XML sitemaps help search engines discover all your pages
  • Include priority and lastmod for important pages
  • Submit to Google Search Console and Bing Webmaster Tools
  • Reference sitemap in robots.txt
Why it matters: Search engines may not discover all your pages through links alone—a sitemap ensures every important page gets indexed, especially for large or newly launched sites.

Rule Details

XML sitemaps help search engines discover and index all your pages.

Code Example

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/</loc>
    <lastmod>2024-01-15</lastmod>
    <changefreq>weekly</changefreq>
    <priority>1.0</priority>
  </url>
  <url>
    <loc>https://example.com/about</loc>
    <lastmod>2024-01-10</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.8</priority>
  </url>
</urlset>

Why It Matters

Search engines may not discover all your pages through links alone—a sitemap ensures every important page gets indexed, especially for large or newly launched sites.

Sitemap Elements

ElementPurposeRequired
locFull URL of the pageYes
lastmodLast modification dateRecommended
changefreqUpdate frequency hintOptional
priorityRelative importance (0.0-1.0)Optional

Next.js Dynamic Sitemap

// app/sitemap.ts
import { MetadataRoute } from 'next'
 
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
  const baseUrl = 'https://example.com'
 
  // Static pages
  const staticPages = [
    '',
    '/about',
    '/contact',
    '/pricing',
  ].map(route => ({
    url: `${baseUrl}${route}`,
    lastModified: new Date(),
    changeFrequency: 'monthly' as const,
    priority: route === '' ? 1.0 : 0.8,
  }))
 
  // Dynamic pages from database
  const products = await getProducts()
  const productPages = products.map(product => ({
    url: `${baseUrl}/products/${product.slug}`,
    lastModified: product.updatedAt,
    changeFrequency: 'weekly' as const,
    priority: 0.7,
  }))
 
  // Blog posts
  const posts = await getPosts()
  const blogPages = posts.map(post => ({
    url: `${baseUrl}/blog/${post.slug}`,
    lastModified: post.updatedAt,
    changeFrequency: 'monthly' as const,
    priority: 0.6,
  }))
 
  return [...staticPages, ...productPages, ...blogPages]
}

Large Sites: Sitemap Index

<?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>2024-01-15</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemap-products.xml</loc>
    <lastmod>2024-01-14</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemap-blog.xml</loc>
    <lastmod>2024-01-13</lastmod>
  </sitemap>
</sitemapindex>
// app/sitemap.ts - Multiple sitemaps
import { MetadataRoute } from 'next'
 
export async function generateSitemaps() {
  const productCount = await getProductCount()
  const numSitemaps = Math.ceil(productCount / 50000)
 
  return Array.from({ length: numSitemaps }, (_, i) => ({ id: i }))
}
 
export default async function sitemap({
  id,
}: {
  id: number
}): Promise<MetadataRoute.Sitemap> {
  const start = id * 50000
  const products = await getProducts({ start, limit: 50000 })
 
  return products.map(product => ({
    url: `https://example.com/products/${product.slug}`,
    lastModified: product.updatedAt,
  }))
}

Priority Guidelines

Page TypeSuggested Priority
Homepage1.0
Main category pages0.8-0.9
Product/service pages0.7-0.8
Blog posts0.5-0.7
Legal pages0.3-0.5
Archive/tag pages0.3-0.4

Reference in robots.txt

User-agent: *
Allow: /
 
Sitemap: https://example.com/sitemap.xml

Image Sitemap Extension

<?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/products/widget</loc>
    <image:image>
      <image:loc>https://example.com/images/widget.jpg</image:loc>
      <image:title>Widget Product Photo</image:title>
    </image:image>
    <image:image>
      <image:loc>https://example.com/images/widget-side.jpg</image:loc>
      <image:title>Widget Side View</image:title>
    </image:image>
  </url>
</urlset>

Submit to Search Engines

# Google Search Console
# 1. Go to https://search.google.com/search-console
# 2. Select property
# 3. Sitemaps → Add new sitemap
# 4. Enter: sitemap.xml
 
# Bing Webmaster Tools
# 1. Go to https://www.bing.com/webmasters
# 2. Submit sitemap URL
 
# Programmatic submission (ping)
curl "https://www.google.com/ping?sitemap=https://example.com/sitemap.xml"
curl "https://www.bing.com/ping?sitemap=https://example.com/sitemap.xml"

What NOT to Include

ExcludeReason
Noindex pagesWon't be indexed anyway
Duplicate contentMay cause issues
404/error pagesBad user experience
Login-required pagesCan't be indexed
Parameter variationsUse canonical URLs

Exceptions

  • Staging, utility, login, account, or internal search pages may intentionally use different crawl or index signals if they are not meant to rank.
  • Temporary migration states can produce noisy intermediate signals; flag the live production URL pattern, not one-off transition artifacts.
  • When redirects, canonicals, robots directives, or indexability signals conflict, fix the strongest final signal first instead of reporting every downstream symptom as a separate blocker.

Verification

Automated Checks

  • Validate XML format with online validators
  • Check Google Search Console sitemap status

Manual Checks

  • Access sitemap at yourdomain.com/sitemap.xml
  • Verify all important pages are included
  • Ensure URLs match canonical-url versions

Use with AI

Copy these prompts to use with your AI assistant, or install the MCP server to use directly from Claude, Cursor, or Windsurf.

Check

Verify implementation

Verify that this website has a valid XML sitemap accessible at /sitemap.xml and that it's properly formatted.

Fix

Auto-fix issues

Generate or update the XML sitemap for this website including all important pages with proper priority and changefreq values.

Explain

Learn more

Explain how XML sitemaps help search engines discover and index website pages more efficiently.

Review

Code review

Review metadata generation, rendered HTML, structured data, and response headers related to Create and submit an XML sitemap. Flag exact routes or templates where search-facing output violates the rule, and describe how to verify the final page output.

Sources

References used to support the guidance in this rule.

Further Reading

Tools and supplementary material for exploring the topic in more depth.

Google Search Console
search.google.comTool

Rules that often go hand-in-hand with this one.

Make important pages indexable

Identifies important pages blocked from search engine indexing by noindex, robots.txt, or other directives

SEO
Publish a robots.txt file

Checks if robots.txt exists at the root, is accessible, and contains valid directives.

SEO
Include indexable pages in your sitemap

Checks for canonical-url, indexable pages that are missing from the XML sitemap.

SEO

Was this rule helpful?

Your feedback helps improve rule quality. This stays internal for now.

Loading feedback...
0 / 385