Sub topic 13
Image, video, news, and hreflang extensions
This chapter assumes you can read a basic sitemap (urlset, url, loc, lastmod), know that sitemaps list URLs you want discovered, and are comfortable with XML namespaces at a reading level. Extensions add extra information to the same <url> entries. They do not replace the standard format.
How extensions work
An extension is a set of extra child elements inside a <url> entry. Each set lives in its own XML namespace, and you declare that namespace on the root <urlset> element. Every extension element carries the namespace prefix, such as image: or video:.
You get three things from this design:
- One file can mix plain entries and entries with extensions.
- The standard rules still apply. Each
<loc>must be an absolute, escaped URL, and each file is limited to 50,000 URLs and 50 MB uncompressed. - Extension data adds to file size but does not add to the URL count. A page with 20 images is still one URL.
| Extension | Namespace prefix | Namespace URI | Main use |
|---|---|---|---|
| Image | `image` | `http://www.google.com/schemas/sitemap-image/1.1` | Images that are hard to discover in the page HTML |
| Video | `video` | `http://www.google.com/schemas/sitemap-video/1.1` | Video metadata for pages that host videos |
| News | `news` | `http://www.google.com/schemas/sitemap-news/0.9` | Recently published articles for news publishers |
| hreflang | `xhtml` | `http://www.w3.org/1999/xhtml` | Language and region versions of a page |
Image extension
Crawlers normally find images by parsing the HTML of your pages. That fails when images are injected by JavaScript, loaded from a CDN on a different domain, or shown only in a gallery script. The image extension lists those images next to the page that contains them.
<?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://www.example.com/gallery/lighthouses</loc>
<lastmod>2026-11-01</lastmod>
<image:image>
<image:loc>https://cdn.example.net/img/lighthouse-1.jpg</image:loc>
</image:image>
<image:image>
<image:loc>https://cdn.example.net/img/lighthouse-2.jpg</image:loc>
</image:image>
</url>
</urlset>Points to know:
- Each
<image:image>needs an<image:loc>. A single page can list up to 1,000 images. - The page
<loc>is the page that shows the image. The image URL can be on another domain, such as a CDN. If the CDN has its ownrobots.txt, make sure it does not block the image files. - The older optional tags
image:caption,image:title,image:geo_location, andimage:licenseare deprecated in Google's documentation. Google no longer uses them, so a minimalimage:locentry is enough.
Video extension
The video extension gives search engines the metadata they need to understand a video without having to play it. Each <video:video> entry requires these fields:
video:thumbnail_loc: URL of a thumbnail image.video:title: the video title.video:description: a description, up to 2,048 characters.video:content_locorvideo:player_loc: a link to the raw video file, or to a player page or embed URL. Provide at least one. Providing both is better.
<?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://www.example.com/videos/knots</loc>
<video:video>
<video:thumbnail_loc>https://www.example.com/thumbs/knots.jpg</video:thumbnail_loc>
<video:title>Three knots every sailor should know</video:title>
<video:description>A short demonstration of the bowline, the clove hitch, and the figure eight.</video:description>
<video:content_loc>https://www.example.com/media/knots.mp4</video:content_loc>
<video:duration>312</video:duration>
<video:publication_date>2026-10-20T08:00:00+00:00</video:publication_date>
</video:video>
</url>
</urlset>Optional fields include video:duration (whole seconds, 1 to 28,800), video:publication_date, video:expiration_date, and video:family_friendly. The loc of the page must be the page where the video can be watched. Search engines compare the sitemap data with what they see on that page, and a mismatch lets them ignore your entry.
News extension
The news extension is for publishers whose content appears in Google News. It has stricter rules than the others, because it is meant to describe fresh content.
<?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://www.example.com/news/harbor-reopens</loc>
<news:news>
<news:publication>
<news:name>Example Gazette</news:name>
<news:language>en</news:language>
</news:publication>
<news:publication_date>2026-11-30T05:45:00+00:00</news:publication_date>
<news:title>Harbor reopens after storm repairs</news:title>
</news:news>
</url>
</urlset>Rules to follow:
- Include only articles published in the last two days. Remove older URLs from the news sitemap. They can stay in your regular sitemap.
- A news sitemap holds at most 1,000
<news:news>entries. Create more files and list them in a sitemap index if you publish more. news:namemust match the publication name used on your site, andnews:languageis a two- or three-letter ISO 639 code (Chinese useszh-cnorzh-tw).news:titleshould match the article headline.news:publication_dateuses W3C format and should include the time zone.- Keep news entries in a dedicated sitemap file, so you can regenerate that file often without touching the others.
hreflang annotations
If a page exists in several languages or for several regions, hreflang annotations tell search engines which version belongs to which audience. You can put them in the page HTML, in HTTP headers, or in the sitemap. The sitemap method is useful when editing templates is hard, or when you have non-HTML files such as PDFs.
In a sitemap, each <url> lists every language version, including itself, with <xhtml:link> elements:
<?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://www.example.com/en/pricing</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/pricing"/>
<xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/preise"/>
<xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/en/pricing"/>
</url>
<url>
<loc>https://www.example.com/de/preise</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/en/pricing"/>
<xhtml:link rel="alternate" hreflang="de" href="https://www.example.com/de/preise"/>
<xhtml:link rel="alternate" hreflang="x-default" href="https://www.example.com/en/pricing"/>
</url>
</urlset>Three rules cause most hreflang problems:
- Include every version in every entry. Each URL must list all alternates and itself. Missing self-references are a common mistake.
- Keep the links reciprocal. If the English page points to the German page, the German page must point back. One-way annotations are ignored.
- Use valid codes. Use an ISO 639-1 language code, optionally followed by an ISO 3166-1 region code (
en,en-gb,pt-br). A region alone, such asgb, is invalid.x-defaultmarks the fallback page for users whose language you do not cover.
Every URL in the hreflang set also needs its own <url> entry, which is why the example above has two. The number of xhtml:link lines grows with the square of the number of languages, so a site with 20 languages writes 20 links per URL. Large sites hit the 50 MB limit sooner than expected, so split files early.
Common failure modes
- Missing namespace declaration. Using
image:locwithoutxmlns:imageon the root makes the XML invalid. Validators report an unbound prefix. - Wrong namespace version. The image namespace ends in
/1.1, the video namespace in/1.1, and the news namespace in/0.9. A typo makes the elements unrecognized. - Unescaped characters. Ampersands in thumbnail or content URLs must be written as
&. Build the file with an XML library, as the generation chapter shows, instead of concatenating strings. - Blocked resources. If
robots.txtdisallows the image folder or the video file, the sitemap points at content the crawler may not fetch. - Stale news entries. Leaving week-old articles in a news sitemap hides the fresh ones among noise and can trigger warnings in the search console.
- Extensions on non-canonical URLs. Put the extension data on the canonical URL only, the same rule you follow for the base entries.
Exercise
A site has an English page and a French page for its pricing information. You add hreflang annotations to the sitemap, but only on the English URL's entry, pointing to the French page. The French URL has a plain entry with no annotations. What is wrong, and how do you fix it?
Show answer
hreflang annotations must be reciprocal and complete. The French entry must also list both the English and French versions, with a self-reference. Add xhtml:link elements for en and fr (and optionally x-default) to the French <url> entry. Without the return links, search engines may ignore the annotations on both pages.
Exercise
You publish 1,400 articles a day and want them in a news sitemap. What two constraints from this chapter affect your design, and what do you do?
Show answer
A news sitemap allows at most 1,000 news entries, and it should contain only articles from the last two days. Split the entries across several news sitemap files, each with no more than 1,000 entries, and list them in a sitemap index. Regenerate them regularly and remove articles older than two days, which can remain in your regular sitemap.