Skip to content
Technical SEOsitemap.xml

XML Sitemap

Definition

An XML sitemap is a structured XML protocol file listing all authoritative, indexable URLs on a website along with metadata (last modification date, change frequency) to facilitate search engine discovery.

Why It Matters

For large websites, e-commerce stores, and newly launched applications with limited backlink profiles, XML sitemaps provide an explicit roadmap for search crawlers. Submitting an accurate sitemap ensures Google discovers deep editorial content, reduces indexing latency for updated pages, and prevents orphaned pages from being overlooked.

Sitemaps.org Protocol Specifications

Criterion / StateRequirement / TargetStatus
Maximum URLs per File50,000 URLs (use Sitemap Index if larger)Optimal
Uncompressed File Size≤ 50 MBOptimal
URL InclusionsOnly canonical, HTTP 200, indexable pagesOptimal
Date EncodingW3C Datetime format (YYYY-MM-DD or ISO 8601)Standard

Practical Implementation Example

Dynamic generation guarantees the XML sitemap reflects real-time CMS publication and accurate lastModified timestamps without manual file editing.

src/app/sitemap.ts
import type { MetadataRoute } from 'next';

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
  const posts = await getPublishedArticles();
  return posts.map((post) => ({
    url: `https://example.com/blog/${post.slug}`,
    lastModified: new Date(post.updatedAt),
    changeFrequency: 'weekly',
    priority: 0.8,
  }));
}
Automated Verification

How to Audit sitemap.xml in ScanWise

ScanWise verifies sitemap XML syntax, compares listed URLs against live crawl responses, and flags non-canonical, redirected, or 404 URLs contaminating the feed.

Audit your XML sitemap hygiene and index coverage in ScanWise

Common sitemap.xml Mistakes & How to Fix Them

Common sitemap.xml Mistakes & How to Fix Them
MistakeWhy It HurtsThe Fix
Including 301 redirects, 404 pages, or noindex URLs in the sitemap feed.Contaminating sitemaps sends conflicting signals to search engines and leads Google to deprioritize your sitemap.Filter sitemap inputs strictly to public, self-canonical, 200 OK indexable routes.
Faking lastmod dates by updating them on every rebuild regardless of actual content changes.Search engines detect fake modification timestamps and cease trusting the sitemap for crawl scheduling.Tie lastmod directly to genuine content edit timestamps stored in your database or repository.