Sitemap Examples: Real XML Samples for Every Site Type
A sitemap tells search engines which pages exist on your site and when they were last updated. But knowing what a correct sitemap actually looks like — and how it differs between a WordPress blog, a Next.js app, and a Shopify store — is what separates a sitemap that gets crawled from one that gets ignored. This guide provides real, copy-ready XML examples for every major site type and extension, along with a breakdown of what makes each one valid.
1. Minimal Valid XML Sitemap Example
The simplest possible sitemap contains just the required elements: the XML declaration, the urlset root element with the correct namespace, and at least one url block containing a loc. This is fully valid per the sitemaps.org protocol and is accepted by Google, Bing, and all major crawlers. Every URL must be absolute (include the full scheme and domain) and must return an HTTP 200 status code.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
</url>
<url>
<loc>https://example.com/about</loc>
</url>
<url>
<loc>https://example.com/contact</loc>
</url>
<url>
<loc>https://example.com/blog</loc>
</url>
</urlset>This is the safest starting point if you are generating a sitemap manually. Never include URLs that redirect, return 4xx/5xx errors, are marked noindex, or are blocked by robots.txt. A sitemap is a recommendation list — anything broken on it trains Googlebot to trust your sitemap less.
2. Full XML Sitemap with All Optional Fields
The sitemap protocol supports four optional fields alongside loc: lastmod, changefreq, and priority. Of these, only lastmod has confirmed value with Google — it helps Googlebot prioritise recrawling recently updated pages. Use ISO 8601 date format (YYYY-MM-DD at minimum). The changefreq and priority fields are ignored by Google and only acted on as loose hints by Bing. Include them if your generator adds them automatically, but do not waste time optimising their values.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-04-15</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://example.com/products</loc>
<lastmod>2026-04-10</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://example.com/blog/how-sitemaps-work</loc>
<lastmod>2026-03-22</lastmod>
<changefreq>monthly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://example.com/legal/privacy</loc>
<lastmod>2025-11-01</lastmod>
<changefreq>yearly</changefreq>
<priority>0.3</priority>
</url>
</urlset>3. Sitemap Index File Example (Large Sites)
Once your site exceeds 50,000 URLs — or once keeping all URLs in a single file becomes unwieldy — you use a sitemap index file. The index references individual child sitemaps using the sitemapindex root element. Each child sitemap can contain up to 50,000 URLs and must itself be under 50 MB uncompressed. You submit only the index URL to Google Search Console — Google follows the references automatically. Child sitemaps can be segmented by content type (posts, products, categories), by date (monthly batches), or by locale for multilingual sites.
<?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>2026-04-15</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-posts-1.xml</loc>
<lastmod>2026-04-29</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-posts-2.xml</loc>
<lastmod>2026-04-20</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-products.xml</loc>
<lastmod>2026-04-28</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-categories.xml</loc>
<lastmod>2026-04-01</lastmod>
</sitemap>
</sitemapindex>The lastmod on a sitemap index entry should reflect the most recent modification date of any URL within that child sitemap. This lets Googlebot skip re-fetching child sitemaps that have not changed since the last crawl.
4. WordPress Sitemap Example (Yoast SEO)
Yoast SEO generates a sitemap index at yourdomain.com/sitemap_index.xml and creates separate child sitemaps per post type and taxonomy. The format includes Yoast's own namespace for image data. Below is a representative Yoast sitemap index followed by an entry in the post sitemap. Note the xhtml:link elements Yoast adds for multilingual sites using WPML or Polylang, and the image extension for featured images.
<!-- Yoast sitemap index (sitemap_index.xml) -->
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="//example.com/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/post-sitemap.xml</loc>
<lastmod>2026-04-29T10:00:00+00:00</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/page-sitemap.xml</loc>
<lastmod>2026-04-15T08:30:00+00:00</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/category-sitemap.xml</loc>
<lastmod>2026-03-10T12:00:00+00:00</lastmod>
</sitemap>
</sitemapindex>
<!-- Yoast post-sitemap.xml (individual entry with image data) -->
<?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/blog/best-seo-tips</loc>
<lastmod>2026-04-25T09:00:00+00:00</lastmod>
<image:image>
<image:loc>https://example.com/wp-content/uploads/2026/04/seo-tips.jpg</image:loc>
<image:title>Best SEO Tips for 2026</image:title>
</image:image>
</url>
</urlset>Yoast automatically excludes pages set to noindex, draft posts, and password-protected content. If you notice pages missing from your Yoast sitemap, check their individual SEO settings — Yoast respects per-post visibility settings over sitemap inclusion settings.
5. Next.js Sitemap Example (MetadataRoute.Sitemap)
Next.js 13.3+ has a built-in sitemap convention using the App Router. You create a sitemap.ts file at the root of your app/ directory and export a default function returning a MetadataRoute.Sitemap array. Next.js renders it as valid XML at /sitemap.xml. For dynamic routes, you fetch your CMS or database inside the function.
// app/sitemap.ts
import type { MetadataRoute } from 'next';
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const baseUrl = 'https://example.com';
// Static pages
const staticRoutes: MetadataRoute.Sitemap = [
{
url: baseUrl,
lastModified: new Date(),
changeFrequency: 'daily',
priority: 1,
},
{
url: `${baseUrl}/about`,
lastModified: new Date('2026-03-01'),
changeFrequency: 'monthly',
priority: 0.8,
},
];
// Dynamic blog posts fetched from CMS
const posts = await fetch('https://cms.example.com/api/posts').then(r => r.json());
const postRoutes: MetadataRoute.Sitemap = posts.map((post: { slug: string; updatedAt: string }) => ({
url: `${baseUrl}/blog/${post.slug}`,
lastModified: new Date(post.updatedAt),
changeFrequency: 'weekly' as const,
priority: 0.7,
}));
return [...staticRoutes, ...postRoutes];
}
/*
Generated XML output at /sitemap.xml:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com</loc>
<lastmod>2026-04-29</lastmod>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>
<url>
<loc>https://example.com/blog/how-sitemaps-work</loc>
<lastmod>2026-04-20</lastmod>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
</urlset>
*/For very large Next.js sites, you can generate multiple sitemap files using the generateSitemaps() export alongside sitemap.ts. Each ID returned from generateSitemaps() maps to a separate sitemap file at /sitemap/0.xml, /sitemap/1.xml, etc.
6. Shopify Sitemap Example
Shopify automatically generates a sitemap index at yourdomain.com/sitemap.xml. It creates four child sitemaps covering products, collections, pages (static CMS pages), and blog posts. You cannot add custom URLs to Shopify's native sitemap — third-party apps like Sitemap Mapper or custom Liquid templates are required for that. Shopify sitemaps include product image data using the image extension namespace.
<!-- Shopify sitemap index (/sitemap.xml) -->
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example-store.com/sitemap_products_1.xml</loc>
<lastmod>2026-04-29T06:00:00-05:00</lastmod>
</sitemap>
<sitemap>
<loc>https://example-store.com/sitemap_collections_1.xml</loc>
<lastmod>2026-04-20T10:00:00-05:00</lastmod>
</sitemap>
<sitemap>
<loc>https://example-store.com/sitemap_pages_1.xml</loc>
<lastmod>2026-03-15T08:00:00-05:00</lastmod>
</sitemap>
<sitemap>
<loc>https://example-store.com/sitemap_blogs_1.xml</loc>
<lastmod>2026-04-28T14:00:00-05:00</lastmod>
</sitemap>
</sitemapindex>
<!-- Shopify product sitemap entry -->
<?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-store.com/products/blue-running-shoes</loc>
<lastmod>2026-04-18T09:00:00-05:00</lastmod>
<image:image>
<image:loc>https://cdn.shopify.com/s/files/1/0001/blue-running-shoes-main.jpg</image:loc>
<image:title>Blue Running Shoes</image:title>
</image:image>
<image:image>
<image:loc>https://cdn.shopify.com/s/files/1/0001/blue-running-shoes-side.jpg</image:loc>
<image:title>Blue Running Shoes - Side View</image:title>
</image:image>
</url>
</urlset>A common Shopify sitemap issue: variant URLs like /products/blue-shoes?variant=123456 are not included in the sitemap (Shopify only lists the canonical product URL). Shopify also excludes hidden products and unpublished pages automatically.
7. Image Sitemap Extension Example
The image sitemap extension allows you to annotate standard sitemap entries with metadata about images on the page. This helps Google Images discover and index images that may not be reachable through standard HTML crawling — particularly useful for lazy-loaded images or images loaded via JavaScript. The extension requires declaring the xmlns:image namespace on the root urlset. Up to 1,000 images can be listed per URL entry.
<?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/gallery/mountain-photography</loc>
<lastmod>2026-04-01</lastmod>
<image:image>
<image:loc>https://example.com/images/mount-fuji-sunrise.jpg</image:loc>
<image:caption>Mount Fuji at sunrise during autumn foliage season</image:caption>
<image:title>Mount Fuji Sunrise</image:title>
<image:license>https://creativecommons.org/licenses/by/4.0/</image:license>
</image:image>
<image:image>
<image:loc>https://example.com/images/yosemite-valley.jpg</image:loc>
<image:caption>Yosemite Valley panorama from Tunnel View</image:caption>
<image:title>Yosemite Valley Panorama</image:title>
</image:image>
<image:image>
<image:loc>https://example.com/images/northern-lights-iceland.jpg</image:loc>
<image:title>Northern Lights over Iceland</image:title>
</image:image>
</url>
</urlset>The image:loc field is the only required element inside image:image. The image URL must be on the same domain or a domain you have verified in Google Search Console. CDN-hosted images on a separate domain are supported as long as that domain is verified.
8. Video Sitemap Extension Example
The video sitemap extension provides metadata that helps Google index your video content and surface it in video search results and rich snippets. It requires declaring the xmlns:video namespace. You must supply either a video:content_loc (direct file URL) or a video:player_loc (embedded player URL) — not necessarily both. The thumbnail, title, and description fields are required for the entry to be eligible for video rich results.
<?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/tutorials/how-to-fix-sitemap-errors</loc>
<video:video>
<video:thumbnail_loc>https://example.com/thumbnails/sitemap-errors-tutorial.jpg</video:thumbnail_loc>
<video:title>How to Fix XML Sitemap Errors in 5 Minutes</video:title>
<video:description>
Step-by-step walkthrough of diagnosing and fixing the most common XML sitemap errors
reported in Google Search Console, including invalid URLs, missing namespaces,
and encoding issues.
</video:description>
<video:content_loc>https://example.com/videos/sitemap-errors-tutorial.mp4</video:content_loc>
<video:player_loc>https://example.com/embed/sitemap-errors-tutorial</video:player_loc>
<video:duration>312</video:duration>
<video:expiration_date>2027-12-31</video:expiration_date>
<video:rating>4.8</video:rating>
<video:view_count>14200</video:view_count>
<video:publication_date>2026-02-14T12:00:00+00:00</video:publication_date>
<video:family_friendly>yes</video:family_friendly>
<video:live>no</video:live>
</video:video>
</url>
</urlset>Duration is in seconds. If your video has no planned expiration, omit video:expiration_date — an expired date causes Google to stop showing your video in search results. For YouTube-hosted videos, you do not need a video sitemap as YouTube handles indexing separately.
9. What a Broken Sitemap Looks Like vs. a Good One
Most sitemap errors fall into a handful of recurring patterns. Here are the most damaging mistakes alongside their correct versions.
Bad: Wrong or missing namespace
<!-- WRONG: Missing xmlns attribute - Google will reject this -->
<?xml version="1.0" encoding="UTF-8"?>
<urlset>
<url>
<loc>https://example.com/</loc>
</url>
</urlset>
<!-- WRONG: Incorrect namespace URL (common typo) -->
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.8">
<!-- CORRECT -->
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">Bad: Relative URLs, HTTP on HTTPS sites, and trailing slash inconsistency
<!-- WRONG: Relative URL --> <loc>/about</loc> <!-- WRONG: HTTP URL when site is HTTPS --> <loc>http://example.com/about</loc> <!-- WRONG: Non-canonical trailing slash (if your canonical is no-slash) --> <loc>https://example.com/about/</loc> <!-- CORRECT: Absolute URL matching your canonical form --> <loc>https://example.com/about</loc>
Bad: Including noindex, redirecting, or error pages
<!-- WRONG: URL is in sitemap but page has noindex meta tag --> <url> <loc>https://example.com/tag/uncategorized</loc> </url> <!-- WRONG: URL redirects to another page (301/302) --> <url> <loc>https://example.com/old-blog-post</loc> </url> <!-- WRONG: URL returns 404 --> <url> <loc>https://example.com/deleted-page</loc> </url> <!-- CORRECT: Only include URLs that return HTTP 200 and are indexable -->
Bad: Invalid lastmod dates
<!-- WRONG: Invalid date format --> <lastmod>April 29, 2026</lastmod> <lastmod>04/29/2026</lastmod> <!-- WRONG: Future date --> <lastmod>2027-01-01</lastmod> <!-- WRONG: Same date for every URL (signals the value is unreliable) --> <!-- Setting every URL to today's date defeats the purpose of lastmod --> <!-- CORRECT: ISO 8601 date of actual last content change --> <lastmod>2026-04-29</lastmod> <lastmod>2026-04-29T10:30:00+00:00</lastmod>
10. How to Test Your Sitemap Against These Examples
Comparing your sitemap visually against examples is a useful first step, but automated testing catches errors that are easy to miss by eye — especially URL status codes, encoding issues, and namespace typos. Here is a systematic testing checklist:
Step 1: Validate XML structure
Paste your sitemap into an XML validator (or use SitemapFixer below) to confirm it is well-formed XML. Check that the root element is urlset (or sitemapindex) and that the namespace is exactly http://www.sitemaps.org/schemas/sitemap/0.9.
Step 2: Check URL status codes
Every URL in your sitemap should return HTTP 200. Redirects (301/302), client errors (404, 410), and server errors (500) should be removed. A sitemap with many non-200 URLs trains search engines to deprioritise your sitemap as a reliable signal.
Step 3: Cross-reference with robots.txt and meta robots
URLs blocked by robots.txt should not appear in your sitemap — a contradiction between the two files creates a confusing signal. Similarly, pages with noindex in their meta robots tag should never be included.
Step 4: Submit to Google Search Console
In Google Search Console, go to Sitemaps and submit your sitemap URL. GSC will report the number of URLs discovered, any errors it encountered, and the number of URLs that have been indexed from your sitemap. Errors shown in GSC take priority over any other tool — fix those first.
For ongoing monitoring, SitemapFixer re-checks your sitemap on every crawl and alerts you when new errors appear — broken URLs, encoding problems, or new noindex conflicts — before they cause indexation gaps.