# Sitemap examples: annotated sitemap.xml files you can copy

> Copy-ready sitemap examples, each annotated line by line: a basic sitemap.xml, a sitemap index, image, video and news sitemaps, hreflang in a sitemap and a plain text sitemap, with the format rules each one must follow.

Updated 2026-09-26 · Technical SEO · HTML version: https://getreport.app/guides/xml-sitemap-example

A sitemap example is the quickest way to see what a valid sitemap.xml looks like: an XML declaration, a `<urlset>` with the sitemaps.org namespace, and one `<url>` per page holding its full address in `<loc>` and, optionally, a `<lastmod>` date. This page gives copy-ready examples of every sitemap type a site owner meets (basic, index, image, video, news, hreflang and plain text), each annotated, followed by the format rules that make or break the file. For what a sitemap does and whether you need one, start with the [XML sitemap guide](https://getreport.app/guides/xml-sitemap).

## Quick answer

- **Basic sitemap:** `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">` with one `<url><loc>…</loc></url>` per page. That is all a valid file needs.
- **Add `<lastmod>`** only when you have the real date the page last changed, as `2026-09-24` or `2026-09-24T09:15:00+02:00`.
- **Leave out `<priority>` and `<changefreq>`.** Google ignores both.
- **Over 50,000 URLs or 50 MB?** Split into several files and list them in a `<sitemapindex>`.
- **Images, video, news and hreflang** each add their own namespace to the `<urlset>` tag and extra elements inside `<url>`.
- **Absolute URLs, UTF-8, escaped `&`.** Those three rules break more sitemaps than anything else.
- Paste your own file's address into the [sitemap checker](https://getreport.app/tools/sitemap-validator) to validate it.

## A basic sitemap.xml example

This is a complete, valid sitemap for a small site with three pages:

```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-09-20</lastmod>
  </url>
  <url>
    <loc>https://example.com/shoes/</loc>
    <lastmod>2026-09-24T09:15:00+02:00</lastmod>
  </url>
  <url>
    <loc>https://example.com/about/</loc>
  </url>
</urlset>
```

Line by line:

1. `<?xml version="1.0" encoding="UTF-8"?>` is the XML declaration. It must be the very first thing in the file, with no blank line or space before it.
2. `<urlset xmlns="…">` opens the list. The namespace must be exactly `http://www.sitemaps.org/schemas/sitemap/0.9`, with `http`, not `https`: it is an identifier, not a link, and a changed character makes the file unreadable to crawlers.
3. `<url>` wraps one page. Every page gets its own.
4. `<loc>` holds the page's full address: protocol, host and path, in the exact form you want indexed. It is the only required child of `<url>`.
5. `<lastmod>` is the date the page's content last changed, in W3C Datetime format: a date alone, or a date and time with a timezone. The third page has none, which is fine.
6. `</urlset>` closes the list. A file cut off before this line is invalid XML.

Save it as UTF-8 and upload it so it answers at `https://example.com/sitemap.xml`. The location matters: a sitemap can only list URLs at or below its own folder unless you submit it in Search Console, so the site root is the usual place.

### The same example with priority and changefreq

You will meet sitemaps that carry two more fields per URL:

```xml
<url>
  <loc>https://example.com/shoes/</loc>
  <lastmod>2026-09-24</lastmod>
  <changefreq>weekly</changefreq>
  <priority>0.8</priority>
</url>
```

Both are valid under the sitemaps.org protocol. `<changefreq>` accepts `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly` or `never`, and `<priority>` a value from 0.0 to 1.0. Google's Search Central documentation says it ignores both, so there is no reason to add them to a new file. They do no harm in an existing one, as long as the values are in range. The guide to [sitemap lastmod](https://getreport.app/guides/sitemap-lastmod-when-to-set-it) explains why the date is the one field worth getting right.

## A sitemap index example

A single sitemap holds at most 50,000 URLs and 50 MB uncompressed. Larger sites, and sites that want one file per section, list several sitemaps in an index:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://example.com/sitemap-products.xml</loc>
    <lastmod>2026-09-25</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemap-categories.xml</loc>
    <lastmod>2026-09-12</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemap-posts.xml.gz</loc>
    <lastmod>2026-09-24</lastmod>
  </sitemap>
</sitemapindex>
```

The differences from a basic sitemap:

- The root element is `<sitemapindex>`, with the same namespace.
- Each child file is a `<sitemap>` entry (not `<url>`) with a `<loc>` and an optional `<lastmod>`, the time that child file last changed.
- A child may be gzipped (`.xml.gz`); the 50 MB limit applies to the uncompressed size.
- An index can list up to 50,000 sitemaps, and it cannot list another index.

You submit only the index; Google reads the children from it. How to split a large site, and what WordPress, Yoast and Rank Math generate on their own, is in [sitemap index files](https://getreport.app/guides/sitemap-index-files-splitting-large-sitemaps).

## An image sitemap example

Image entries sit inside the page's `<url>` and need their own namespace on the `<urlset>` tag:

```xml
<?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/shoes/alpina-pro/</loc>
    <image:image>
      <image:loc>https://cdn.example.com/img/alpina-pro-side.jpg</image:loc>
    </image:image>
    <image:image>
      <image:loc>https://cdn.example.com/img/alpina-pro-sole.jpg</image:loc>
    </image:image>
  </url>
</urlset>
```

`<image:loc>` is the only image tag Google still reads. It retired `<image:caption>`, `<image:title>`, `<image:geo_location>` and `<image:license>` in 2022, in a Search Central blog post on sitemap extensions, so leave them out. Up to 1,000 images can be listed per page, and they may live on another host such as a CDN, as in the example.

## A video sitemap example

A video entry describes one video embedded on the page in `<loc>`:

```xml
<?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/videos/how-to-lace-hiking-boots/</loc>
    <video:video>
      <video:thumbnail_loc>https://example.com/thumbs/lacing.jpg</video:thumbnail_loc>
      <video:title>How to lace hiking boots</video:title>
      <video:description>Three lacing methods that stop heel lift on steep descents.</video:description>
      <video:content_loc>https://cdn.example.com/video/lacing.mp4</video:content_loc>
      <video:duration>184</video:duration>
      <video:publication_date>2026-09-10T08:00:00+02:00</video:publication_date>
    </video:video>
  </url>
</urlset>
```

Google requires `<video:thumbnail_loc>`, `<video:title>` and `<video:description>`, plus at least one of `<video:content_loc>` (the video file itself) or `<video:player_loc>` (an embeddable player URL, which is what you use for a hosted player). `<video:duration>` is in seconds, from 1 to 28,800. Google stopped using `<video:category>`, `<video:gallery_loc>`, `<video:price>` and `<video:tvshow>` in August 2022. When a video sitemap is worth the effort, and when it is not, is covered in [image and video sitemaps](https://getreport.app/guides/image-and-video-sitemaps).

## A news sitemap example

For publishers in Google News, a news sitemap lists articles published in the last two days:

```xml
<?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/trail-closures-autumn-2026/</loc>
    <news:news>
      <news:publication>
        <news:name>Example Trail News</news:name>
        <news:language>en</news:language>
      </news:publication>
      <news:publication_date>2026-09-25T14:30:00+02:00</news:publication_date>
      <news:title>Five alpine trails close early this autumn</news:title>
    </news:news>
  </url>
</urlset>
```

`<news:name>` must match the publication name Google News shows for you, and `<news:language>` is an ISO 639 code. A news sitemap holds up to 1,000 `<news:news>` entries; older articles drop out of it after two days but stay in your normal sitemap.

## A hreflang sitemap example

A multilingual site can declare its language versions in the sitemap instead of in each page's head. Each `<url>` lists every version, itself included:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://example.com/en/boots/</loc>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/boots/"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/stiefel/"/>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en/boots/"/>
  </url>
  <url>
    <loc>https://example.com/de/stiefel/</loc>
    <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/boots/"/>
    <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/stiefel/"/>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en/boots/"/>
  </url>
</urlset>
```

The German page gets its own `<url>` with the same three lines. Leaving it out breaks the return link and Google ignores the pair. Use one method only: if the pages already carry hreflang tags, do not add a second set in the sitemap. [hreflang in sitemaps vs in HTML](https://getreport.app/guides/hreflang-in-sitemaps-vs-in-html) compares the methods.

## A plain text sitemap example

Google also accepts a text file with one full URL per line and nothing else:

```text
https://example.com/
https://example.com/shoes/
https://example.com/about/
```

Save it as UTF-8 with a `.txt` extension, such as `sitemap.txt`. The same 50,000-URL and 50 MB limits apply. A text sitemap cannot carry dates, images, video or hreflang, so it suits only a small static site where you write the list by hand. Google also reads RSS 2.0, mRSS and Atom 1.0 feeds as sitemaps.

## The XML sitemap format rules

The sitemaps.org protocol and Google's "Build and submit a sitemap" page set a short list of rules. A file that breaks one may be rejected entirely:

| Rule | Right | Wrong |
| --- | --- | --- |
| Absolute URLs | `https://example.com/shoes/` | `/shoes/` |
| One host per file | Every `<loc>` on the sitemap's own host | A mix of `www.` and bare domain |
| Escaped special characters | `?size=42&amp;colour=red` | `?size=42&colour=red` |
| W3C dates | `2026-09-24` or `2026-09-24T09:15:00+02:00` | `24/09/2026`, `Sep 24 2026` |
| UTF-8 encoding | Saved as UTF-8 | Saved as Windows-1252 |
| Size | At most 50,000 URLs and 50 MB uncompressed | One 80 MB file |
| URL length | Under 2,048 characters | Very long filter URLs |

Five characters must be written as entities inside XML: `&` as `&amp;`, `<` as `&lt;`, `>` as `&gt;`, `'` as `&apos;` and `"` as `&quot;`. Letters outside ASCII in a URL, such as `č` or `ü`, should be percent-encoded the way a browser sends them.

What goes in is as important as the format. List only final URLs that answer 200, have no `noindex` and are their own canonical; leave out redirects, 404s, duplicates and pages blocked in robots.txt. The [XML sitemap guide](https://getreport.app/guides/xml-sitemap) explains why.

### A broken example, and what is wrong with it

```xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>/shoes/?size=42&colour=red</loc>
    <lastmod>24.09.2026</lastmod>
    <priority>high</priority>
  </url>
```

Six problems in seven lines: the namespace uses `https`, the URL is relative, the `&` is not escaped, the date is not a W3C date, `priority` must be a number, and the closing `</urlset>` is missing. Any one of them is enough for Search Console to report "Sitemap could not be read" or "has errors". The errors and their fixes are listed in [XML sitemap validation](https://getreport.app/guides/xml-sitemap-validation).

## Where the sitemap goes and how crawlers find it

Upload the file to the root of the site and add its full address to robots.txt, on a line of its own:

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

The line can go anywhere in robots.txt, and you can add one line per sitemap or point a single line at the index. Then submit the same address once in Google Search Console and Bing Webmaster Tools.

Most sites never write this file by hand: WordPress, Shopify, Wix, Squarespace and the common SEO plugins build and update it automatically. [How to create an XML sitemap](https://getreport.app/guides/how-to-create-an-xml-sitemap) covers each route, including a generator for sites that have none.

## How to check your own file

> **Free tool:** [Sitemap checker: validate your XML sitemap](https://getreport.app/tools/sitemap-validator): Free sitemap checker: find your XML sitemap, validate it against the sitemaps.org protocol, count its URLs and test a sample of the listed pages. No sign-up.

The sitemap checker reads the sitemaps declared in robots.txt (up to three) and `/sitemap.xml`, unpacks gzipped files and parses each with a strict XML parser. It reports the root element and namespace, relative or other-host URLs, invalid dates, out-of-range changefreq and priority values, repeated URLs and the 50,000-URL limit, then requests up to 25 listed URLs to confirm they answer 200. Image and video extensions are accepted but not validated yet, so check those elements against the examples above.

> **Check: The XML sitemap follows the sitemaps.org protocol.** Google reads a sitemap only when it is well-formed XML with absolute URLs and valid dates. One bad file means new pages are found late or not at all, and Search Console reports "couldn't fetch".
>
> 1. Regenerate the sitemap from your CMS or SEO plugin instead of editing it by hand, and validate it after every change.
> 2. Use absolute https URLs in <loc>, dates as YYYY-MM-DD in <lastmod>, and split files above 50,000 URLs into a sitemap index.

> **Check: robots.txt declares a sitemap.** A "Sitemap:" line in robots.txt is how crawlers find your XML sitemap without you registering it anywhere. Without it, new pages are discovered later.
>
> 1. Add a line to robots.txt: Sitemap: https://your-site.com/sitemap.xml (use the full URL).

## Common mistakes

- **Copying an example with `example.com` left in it.** Every `<loc>` must be your own address, on the host where the sitemap lives.
- **A blank line or a byte-order mark before `<?xml`.** Some editors add it; the parser then refuses the file.
- **Namespace typed with `https`.** It looks more modern but it is a different identifier, and the file fails.
- **Every `<lastmod>` set to the day the file was generated.** Google then ignores the dates for the whole file.
- **Image and video tags without their namespace** on the `<urlset>` tag, which makes the XML invalid.
- **An index that lists another index.** Indexes cannot nest; list the child sitemaps directly.

## Questions people ask

### What is an example of a sitemap URL?

The most common sitemap URL is `https://example.com/sitemap.xml`, at the root of the site. WordPress core uses `/wp-sitemap.xml`, Yoast SEO and Rank Math use `/sitemap_index.xml`, and Shopify, Wix and Squarespace use `/sitemap.xml`. Whatever the address, it should appear on a `Sitemap:` line in the site's robots.txt, which is where crawlers and people look first.

### What is the correct XML sitemap format?

A UTF-8 XML file that starts with the XML declaration, has a `<urlset>` root with the namespace `http://www.sitemaps.org/schemas/sitemap/0.9`, and one `<url>` per page containing an absolute `<loc>` and, optionally, a W3C-format `<lastmod>`. Special characters are escaped, and one file holds at most 50,000 URLs and 50 MB uncompressed.

### Is lastmod required in a sitemap?

No, only `<loc>` is required. `<lastmod>` is optional, but it is the one optional field Google uses, to decide which pages to recrawl. Add it only when your system knows the real date each page's content last changed. A date that is missing is neutral; dates that are all set to today teach Google to ignore the field.

### Can one sitemap file list pages from two domains?

Normally no. Every URL in a sitemap should be on the same host as the sitemap file. Cross-host listing works only when you prove you own both hosts, by declaring the sitemap in the other host's robots.txt or by verifying both in Search Console. For a `www` and a bare domain, pick one canonical host and list only that one.
