XML Sitemap Examples
Annotated XML sitemap examples: basic sitemaps, sitemaps with optional fields, sitemap index files, news sitemaps, image sitemaps, and video sitemaps. Copy-paste templates with explanations.
Sometimes you just need to see what a correct sitemap looks like. This page has annotated examples for every common sitemap type -- from the simplest possible sitemap to specialized formats for news, images, and video. Each example is valid, copy-paste ready, and explained line by line.
Basic Sitemap
The simplest valid sitemap. Two URLs, no optional fields, nothing extra.
<?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>
</urlset>
Line by line:
<?xml version="1.0" encoding="UTF-8"?>-- XML declaration. Required. Tells parsers this is an XML document with UTF-8 encoding.<urlset xmlns="...">-- Root element. Thexmlnsattribute specifies the sitemap protocol namespace. This is required -- without it, search engines may not recognize the file as a sitemap.<url>-- Container for a single URL entry.<loc>-- The URL itself. Must be an absolute URL including the protocol (https://). This is the only required element inside<url>.</urlset>-- Closing tag for the root element.
This is enough. A sitemap with just <loc> elements is perfectly valid and will be processed by every search engine that supports the protocol.
Sitemap with All Optional Fields
The sitemap protocol defines three optional elements: <lastmod>, <changefreq>, and <priority>. Here's an example using all of them.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2025-06-15</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://example.com/blog/xml-sitemaps-explained</loc>
<lastmod>2025-06-10T14:30:00+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://example.com/contact</loc>
<lastmod>2025-01-20</lastmod>
<changefreq>yearly</changefreq>
<priority>0.3</priority>
</url>
</urlset>
Optional fields explained:
<lastmod>-- The date the page was last meaningfully modified. Use W3C Datetime format:YYYY-MM-DDor the full datetimeYYYY-MM-DDThh:mm:ss+00:00. Google uses this when it's accurate.<changefreq>-- How often the page is likely to change. Valid values:always,hourly,daily,weekly,monthly,yearly,never. Google has stated that it largely ignores this field.<priority>-- A value from 0.0 to 1.0 indicating relative importance within your site. Default is 0.5. Google has confirmed that it ignores this field entirely.
Which optional fields to use
Focus on <lastmod> -- it's the only optional field that Google actually uses. Skip <changefreq> and <priority> or include them if your CMS generates them automatically. Don't spend time optimizing fields that search engines ignore.
Sitemap Index
A sitemap index file references multiple individual sitemaps. Use this when your site has more URLs than fit in a single sitemap, or when you want to organize sitemaps by content type.
<?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-06-15</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-blog.xml</loc>
<lastmod>2025-06-14</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-products.xml</loc>
<lastmod>2025-06-15</lastmod>
</sitemap>
</sitemapindex>
Key differences from a regular sitemap:
- The root element is
<sitemapindex>instead of<urlset> - Each entry uses
<sitemap>instead of<url> - The
<loc>points to another sitemap file, not a web page <lastmod>indicates when the referenced sitemap was last updated- A sitemap index can reference up to 50,000 sitemaps
- Sitemap index files cannot reference other sitemap index files (no nesting)
When to use a sitemap index
You don't need tens of thousands of URLs to benefit from a sitemap index. Even a site with 200 URLs can organize them into separate sitemaps by content type. It makes debugging easier and lets search engines re-process only the sitemaps that changed.
Validate your sitemap structure
Check that your sitemap or sitemap index follows the protocol correctly. Instant results.
News Sitemap
Google News sitemaps use an additional namespace and elements to describe news articles. Only include articles published within the last two days.
<?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/market-update-june-2025</loc>
<news:news>
<news:publication>
<news:name>Example News</news:name>
<news:language>en</news:language>
</news:publication>
<news:publication_date>2025-06-15T08:00:00+00:00</news:publication_date>
<news:title>Market Update: June 2025 Quarterly Report</news:title>
</news:news>
</url>
</urlset>
News-specific elements:
xmlns:news-- Additional namespace declaration for news sitemap elements. Added to the<urlset>tag.<news:publication>-- Contains the publication name and language.<news:name>-- The name of your news publication, as it appears in Google News.<news:language>-- ISO 639 language code (e.g.,en,fr,de).<news:publication_date>-- The date and time the article was published. Must be in W3C Datetime format with timezone.<news:title>-- The article headline.
Rules for news sitemaps:
- Only include articles from the last 48 hours
- Maximum 1,000 URLs per news sitemap
- You must be registered with Google News Publisher Center
- Don't include non-news content in a news sitemap
Image Sitemap
Image sitemaps help search engines discover images that might not be found through normal crawling -- especially images loaded via JavaScript or CSS.
<?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/running-shoes</loc>
<image:image>
<image:loc>https://example.com/images/running-shoes-front.jpg</image:loc>
<image:title>Running Shoes - Front View</image:title>
<image:caption>Lightweight running shoes with breathable mesh upper, available in blue and black.</image:caption>
</image:image>
<image:image>
<image:loc>https://example.com/images/running-shoes-side.jpg</image:loc>
<image:title>Running Shoes - Side View</image:title>
</image:image>
</url>
</urlset>
Image-specific elements:
xmlns:image-- Image namespace declaration.<image:image>-- Container for a single image. You can include up to 1,000 images per<url>entry.<image:loc>-- The URL of the image. Required. Must be an absolute URL.<image:title>-- The title of the image. Optional but recommended.<image:caption>-- A description of the image. Optional but helps with image search SEO.
You can combine image entries with regular sitemap elements. The page URL goes in <loc>, and the images associated with that page go in <image:image> blocks within the same <url> entry.
Video Sitemap
Video sitemaps provide metadata about video content on your pages, helping Google surface your videos in search results and Google Video.
<?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/getting-started</loc>
<video:video>
<video:thumbnail_loc>https://example.com/thumbnails/getting-started.jpg</video:thumbnail_loc>
<video:title>Getting Started Tutorial</video:title>
<video:description>A 5-minute walkthrough of setting up your account and running your first project.</video:description>
<video:content_loc>https://example.com/videos/getting-started.mp4</video:content_loc>
<video:duration>300</video:duration>
<video:publication_date>2025-03-20T10:00:00+00:00</video:publication_date>
</video:video>
</url>
</urlset>
Video-specific elements:
xmlns:video-- Video namespace declaration.<video:thumbnail_loc>-- URL of the video thumbnail image. Required.<video:title>-- The title of the video. Required.<video:description>-- A description of the video. Required. Maximum 2,048 characters.<video:content_loc>-- A URL pointing to the actual video file. Use this or<video:player_loc>(for embedded players like YouTube).<video:duration>-- Duration in seconds. Optional but recommended.<video:publication_date>-- When the video was first published. Optional.
Comparing Sitemap Types
| Type | Root Element | Extra Namespace | Max URLs | Use Case |
|---|---|---|---|---|
| Standard | <urlset> | None | 50,000 | Most websites |
| Sitemap Index | <sitemapindex> | None | 50,000 sitemaps | Large sites, organization |
| News | <urlset> | xmlns:news | 1,000 | News publishers |
| Image | <urlset> | xmlns:image | 50,000 (1,000 images each) | Image-heavy sites |
| Video | <urlset> | xmlns:video | 50,000 | Sites with video content |
Common Mistakes in Examples Online
Many sitemap examples you'll find on the web contain errors. Watch out for:
- Missing the xmlns namespace -- Without it, the file is valid XML but not a valid sitemap
- Using relative URLs --
<loc>/page</loc>is invalid; always use absolute URLs - Unescaped ampersands --
&must be written as&in XML - Wrong date formats --
06/15/2025is not valid; use2025-06-15 - Mixing sitemap types incorrectly -- A sitemap index can only contain
<sitemap>entries, not<url>entries
Every example on this page is valid and ready to use as a starting point. Copy the structure, replace the URLs and metadata with your own, and validate the result.
Related Articles
Good sitemaps start with good examples. Now go build yours.
Validate your XML sitemap
Check your sitemap for errors, broken URLs, and indexing issues. Free instant validation.