In one sentence: A sitemap is"a list of URLs I want search engines to see", telling Google which pages are important, when they were updated, and whether they have videos/images/news/multilingual versions.It is a hint, not a command — submitting it ≠ guaranteed indexing, but it can significantly improve discovery efficiency for large sites, new sites, and rich media sites.
TL;DR — Should you build a sitemap
| If your site looks like this | Recommendation |
|---|---|
| ≥500 pages + incomplete internal links | Do it |
| New site with few external links | Do it |
| Has lots of images/videos/news | Do it |
| Uses a CMS such as WordPress / Wix / Blogger | The CMS already did it, you don’t need to do anything |
| < 500 pages and all reachable via internal links | Not necessary, Google can crawl all of them on its own |
| No videos/images/news and no need to appear in corresponding vertical search | Not necessary |
Part 1 — Choosing among the 3 sitemap formats
Google does not prefer any one format.Choose based on your CMS and needs.
| Format | Pros | Cons | Best for |
|---|---|---|---|
| XML sitemap | Most flexible — supports the 4 major extensions image/video/news/hreflang; most CMSes can generate it automatically | Tedious to write; high maintenance cost for large sites | Default first choice, especially when rich media is present |
| RSS / mRSS / Atom 1.0 | Most CMSes generate it automatically; mRSS supports video | Can only include recent URLs (not all); besides text it only supports video,does not support image/news | Already has an RSS feed and only cares about new pages |
| Text sitemap | Extremely simple — one URL per line | Only for HTML text pages, no extensions supported at all | Plain text sites + large number of URLs + no need for rich media |
1.1 Minimal XML sitemap example
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/foo.html</loc>
<lastmod>2022-06-04</lastmod>
</url>
</urlset>
1.2 ⚠️ About <priority> and <changefreq>
Google completely ignores them. Don’t waste time setting them.
1.3 ⚠️ About <lastmod>
- Must be truthful — changing the copyright year / tweaking a small piece of text does not count as a "significant update"
- "Significant update" = main content changed, structured data changed, links changed
- If your dates are inaccurate → Google will directly ignore the entire
<lastmod>field → lose this scheduling signal - This is one of the few fields that "penalizes cheating"
1.4 Text sitemap example
https://www.example.com/file1.html
https://www.example.com/file2.html
Filename can be anything,but it must use the .txt filename extension. Inside the file put only URLs, one per line, nothing else.
Part 2 — General Best Practices (applies to all formats)
2.1 Hard limits (must split if exceeded)
- Single file ≤ 50MB (uncompressed)
- Single file ≤ 50,000 URLs
- Encoding must be UTF-8
Exceeding any limit → must split into multiple sitemaps + use sitemap index.
2.2 URL format
- Must be absolute URLs — use
https://www.example.com/mypage.html,Cannot/mypage.html - Must include the canonical URL — when one piece of content has multiple URLs,only include the one you want Google to show
- If you have separate desktop/mobile URLs,include only one version(or include both but mark the
mobile-first-indexingannotation in the markup)
2.3 Sitemap file location = scope boundary
| Placed at | Affected scope |
|---|---|
https://example.com/sitemap.xml(root directory) |
Entire site ✅ Recommended |
https://example.com/subdir/sitemap.xml |
Only valid for /subdir/ and its subdirectories |
| Submitted via Search Console | Scope is not restricted by file location |
Principle: place it in the root directory by default, unless you have a specific need.
2.4 URL order does not matter
Google does not care about the order of URLs in your sitemap. Order them however you like.
Part 3 — How to generate a sitemap (3 approaches)
A. Let the CMS generate it automatically (preferred)
WordPress / Wix / Blogger / Shopify and others all have it automatically. Google "wix sitemap" or "blogger RSS" to see how your CMS exposes it.
B. Write it manually (only feasible for < a few dozen URLs)
Write line by line in Notepad / nano. Extremely high maintenance cost,not recommended for sites with dozens of pages or more.
C. Auto-generate with tools/scripts (dozens~50,000 URLs)
Best practice:Export the URL list from your site database → output the sitemap file. Having the website system generate it directly is the most stable, because the sitemap updates automatically every time new content is published.
Third-party tool list (old but usable):code.google.com/p/sitemap-generators/wiki/SitemapGenerators.
Part 4 — Sitemap Index (solution for large sites)
4.1 When you need it
- A single sitemap approaches the 50MB or 50,000 URL limit
- You want to track the indexing status of each sitemap separately in Search Console (corresponding to different sections / content types)
4.2 Example
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.example.com/sitemap1.xml.gz</loc>
<lastmod>2024-08-15</lastmod>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemap2.xml.gz</loc>
<lastmod>2022-06-05</lastmod>
</sitemap>
</sitemapindex>
Note:Child sitemaps can use the .xml.gz compressed format, compressed transfer is strongly recommended for large sites.
4.3 Hard rules
| Rule | Limit |
|---|---|
| Maximum number of sitemaps in one sitemap index | 50,000 items<loc> |
| Maximum number of sitemap indexes per site | 500 items |
| Child sitemaps must be hosted on the same site hosted | Exception: cross-site submission (see Part 9) |
| Child sitemaps must be in the same directory as the sitemap index or deeper | Example: if the index is at /public/sitemap_index.xml it can only reference sitemaps under /public/* or /public/sub/* sitemap under |
4.4 Required/optional tags
| Tag | Required? | Description |
|---|---|---|
<sitemapindex> |
✅ | Root tag |
<sitemap> |
✅ | One per child sitemap |
<loc> |
✅ | URL of the child sitemap |
<lastmod> |
❌ | Helps Google schedule crawl priority,strongly recommended |
Part 5 — The 4 Major Extension Namespaces
| Extension | Namespace URL |
|---|---|
image: |
http://www.google.com/schemas/sitemap-image/1.1 |
news: |
http://www.google.com/schemas/sitemap-news/0.9 |
video: |
http://www.google.com/schemas/sitemap-video/1.1 |
xhtml:(hreflang multilingual) |
http://www.w3.org/1999/xhtml |
5.1 Combined declaration (using multiple extensions in one sitemap)
<?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"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<!-- 接下来 news + video + xhtml 标签可以混用 -->
</url>
</urlset>
5.2 Tag order does not matter
As long as <loc> comes first. The order of other extension tags is arbitrary.
5.3 ⚠️ Multiple extensions significantly increase file size
Watch out for the 50MB limit. You may need to split into a sitemap index earlier.
Part 6 — Image Sitemap
6.1 Purpose
Tell Google about images it cannot normally crawl (typically: images dynamically injected by JavaScript).
6.2 Full example
<?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/sample1.html</loc>
<image:image>
<image:loc>https://example.com/image.jpg</image:loc>
</image:image>
<image:image>
<image:loc>https://example.com/photo.jpg</image:loc>
</image:image>
</url>
</urlset>
6.3 Required fields
| Tag | Description |
|---|---|
<image:image> |
One per image,up to 1000 images per <url> up to 1,000 images |
<image:loc> |
Image URL |
6.4 Cross-domain images (CDN)
Allowed,but you must also verify the domain where the images are hosted in Search Console (for example, if images are hosted on Google Sites, you must verify that domain). Also, robots.txt must not disallow these images.
6.5 Deprecated fields (Spring 2022 cleanup)
❌ <image:caption>, <image:geo_location>, <image:title>, <image:license> — Do not use them anymore, Google already ignores them.
Part 7 — Video Sitemap
7.1 Purpose
Tell Google about newly published videos + and videos it cannot crawl (JS-loaded, embedded from external sites, etc.).
7.2 Key required fields
| Tag | Description |
|---|---|
<video:video> |
One per video, multiple can be nested under one <url> nest multiple under |
<video:thumbnail_loc> |
Thumbnail URL (thumbnail requirements) |
<video:title> |
Video title, must match the page, HTML entities must be escaped or wrapped in CDATA |
<video:description> |
Video description,maximum 2048 characters, must match the page (does not need to be verbatim) |
<video:content_loc> or <video:player_loc> |
one of the two is required |
7.3 content_loc vs player_loc Which one to choose for
<video:content_loc>takes priority: points to the original video file (.mp4 etc.). Most efficient for Google to fetch.HTML and Flash are not supported. Cannot be equal to<loc>.<video:player_loc>fallback: points to the player URL (the content of<embed src=>).Embedded sites such as YouTube / Vimeo can only use this.
Want to restrict access but still let Google see it? Use verifying Googlebot reverse IP verification + whitelist.
7.4 Key optional fields
| Tag | Description |
|---|---|
<video:duration> |
In seconds, 1~28800 (8 hours) |
<video:expiration_date> |
W3C date format, will not be shown in search after expiration |
<video:rating> |
Float from 0.0 to 5.0 |
<video:view_count> |
Play count |
<video:publication_date> |
First publication time (W3C format) |
<video:family_friendly> |
yes/no, default yes, controlled by SafeSearch |
<video:restriction relationship="allow">CA MX</video:restriction> |
ISO 3166 country codes, space-separated. Allow/deny display in certain countries |
<video:platform relationship="allow">web tv</video:platform> |
web / mobile / tv, restrict to certain devices |
<video:requires_subscription> |
yes/no |
<video:uploader info="..."> |
Uploader name (≤255 characters) + optional personal page URL (same domain) |
<video:live> |
yes/no |
<video:tag> |
Tags, per video up to 32, one element per tag |
7.5 Deprecated fields (Spring 2022 cleanup)
❌ <video:category>, <video:gallery_loc>, <video:price> (and all its attributes),<video:tvshow> (and all its attributes),<video:player_loc> the autoplay and allow_embed attributes — do not use anymore.
7.6 Video sitemap crawl restrictions
- Video file URL must not be disallowed by robots.txt
- Must not require login / metafile
- Googlebot must not be blocked by a firewall
- Must use HTTP or FTP protocol,Streaming protocols are not supported
7.7 mRSS alternative
Google also supports mRSS feeds for video, which is equivalent to video sitemap, just in a different format. It is more convenient if your CMS automatically produces RSS. Required structure:<media:content> (including medium="video" + url or <media:player>) + <media:title> + <media:description> + <media:thumbnail>.
Part 8 — News Sitemap
8.1 Purpose
For news publisher only. Tells Google News about your news articles.
8.2 5 iron rules ⭐⭐⭐
- Only include articles published in the last 2 days. URLs older than 2 days should either be removed from the sitemap, or have their
<news:news>metadata removed. - Update the existing sitemap, do not create a new sitemap every time you publish an article.
<news:name>must exactly match the publication name displayed on news.google.com (remove content in parentheses).<news:publication_date>is the first publication time, not the time you write it into the sitemap.- One sitemap can contain at most 1000
<news:news>tags (split into a sitemap index if exceeded).
Empty Sitemap warning: If you do not publish news for several days, the sitemap may become empty and Search Console will show a warning.This is not an error, Google just wants to confirm you did it intentionally. An empty sitemap does not affect search.
8.3 Full required fields
| Tag | Description |
|---|---|
<news:news> |
Parent tag, at most one per <url> at most one |
<news:publication> |
Parent tag, contains name + language |
<news:name> |
Publication name, must match news.google.com |
<news:language> |
ISO 639 language code (2-3 letters).Simplified Chinese uses zh-cn, Traditional Chinese uses zh-tw |
<news:publication_date> |
W3C format date/time.Use the first publication time, not the time added to the sitemap. |
<news:title> |
Article title.Do not stuff author name/publication name/date, Google will add these automatically. |
8.4 Example
<?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>http://www.example.org/business/article55.html</loc>
<news:news>
<news:publication>
<news:name>The Example Times</news:name>
<news:language>en</news:language>
</news:publication>
<news:publication_date>2008-12-23</news:publication_date>
<news:title>Companies A, B in Merger Talks</news:title>
</news:news>
</url>
</urlset>
Part 9 — 4 Ways to Submit a Sitemap
Method 1: Search Console (recommended)
Sitemaps report submission.Biggest advantage: see when Google accessed it, when errors occurred, and processing status.
Method 2: Search Console API
Programmatic submission: /webmaster-tools/v1/sitemaps/submit. Suitable for automation / managing large numbers of sitemaps.
Method 3: Declare in robots.txt
Sitemap: https://example.com/my_sitemap.xml
Location can be anywhere, Google will discover it the next time it crawls robots.txt.
Method 4: WebSub (Atom/RSS only)
For RSS/Atom use WebSub to broadcast changes to search engines, real-time push.
⚠️ Consensus
Submitting a sitemap is only hint,it does not guarantee Google will actually download it or use it to crawl. If submission shows no effect → check errors in the Search Console Sitemaps report.
Part 10 — Cross-site sitemap submission
If you manage multiple domains, you can write URLs for multiple sites in one sitemap to simplify submission.
10.1 Two approaches
A. One sitemap covering multiple domains
https://host1.example.com/sitemap.xml 内容:
- https://host1.example.com
- https://host2.example.com
- https://host3.example.com
- https://host1.example.ch
B. Multiple sitemaps centralized in one location
https://host1.example.com/host1-example-sitemap.xml
https://host1.example.com/host2-example-sitemap.xml
https://host1.example.com/host3-example-sitemap.xml
10.2 Required prerequisites
- Verify ownership of all relevant sites in Search Console
- Submit via Search Console,or reference its corresponding sitemap in each site's
robots.txt:
# https://example.com/robots.txt
sitemap: https://sitemaps.example.com/sitemap-example-com.xml
Part 11 — Multilingual sitemaps (hreflang via xhtml extension)
Declare language/regional versions directly in the sitemap, equivalent to HTML's <link rel="alternate" hreflang="..."> but more centralized and easier to maintain.
<url>
<loc>https://www.example.com/english/page.html</loc>
<xhtml:link rel="alternate" hreflang="de" href="https://www.example.de/deutsch/page.html"/>
<xhtml:link rel="alternate" hreflang="de-ch" href="https://www.example.de/schweiz-deutsch/page.html"/>
<xhtml:link rel="alternate" hreflang="en" href="https://www.example.com/english/page.html"/>
</url>
Note: Every <url> must list all language versions in full (including itself). If you omit the entry for itself, Google will not automatically add it. For details see The Complete Guide to Internationalization (hreflang/multilingual/multi-regional) + Explicit Content (SafeSearch/Adult) (upcoming wiki).
Part 12 — 13 anti-patterns (common mistakes)
| # | Anti-pattern | Consequence |
|---|---|---|
| 1 | Setting <priority> / <changefreq> |
is wasted effort; Google ignores it completely |
| 2 | <lastmod> changing it to "today" every time you publish / inaccurate values |
Google directly ignores the entire field |
| 3 | Placing the sitemap in /subdir/ but expecting it to affect the root |
scope applies only to subdirectories; either move it to the root or submit via Search Console |
| 4 | Using relative URLs | Google will crawl them "literally", which will most likely result in 404s |
| 5 | Listing two URLs for the same page (mobile + desktop) without annotation | Confuses canonical signals |
| 6 | A single sitemap exceeding 50MB or 50,000 URLs without splitting | Google reports an error or truncates it |
| 7 | Leaving articles older than ≥2 days in a News sitemap | Violates News rules |
| 8 | The <news:name> in a News sitemap does not match news.google.com |
Articles are rejected |
| 9 | Stuffing author/date into News sitemap titles | Causes duplicate display; Google recommends removing them |
| 10 | Image sitemaps still using <image:caption> / <image:title> / <image:license> |
is deprecated and will be ignored |
| 11 | Video sitemaps using <video:price> / <video:category> |
is deprecated and will be ignored |
| 12 | Video content URL <video:content_loc> is identical to the page <loc> |
Parsing fails |
| 13 | XML characters not escaped | XML parsing fails, the entire sitemap is unusable |
Part 13 — Troubleshooting
For any sitemap issue, go to Search Console Sitemaps troubleshooting guide to check. Common errors:
- HTTP error — file 404 / 500 / redirect chain
- XML parse error — unescaped entities, misspelled namespace, missing
<loc>Missing - URL error — relative URL, cross-domain without verification, blocked by robots.txt
- Empty Sitemap warning(News-specific) — see Part 8.2, generally can be ignored
Part 14 — Related wiki pages
- To understand how Googlebot finds you: Google SEO Basics + How Search Works + Search Essentials crawl/index/serve three-stage process
- File types / indexing rules: The Complete Guide to Googlebot Crawling Mechanisms and Indexing Control (URL/Links/Mobile-first/Meta/Testing/AMP) (upcoming wiki)
- robots.txt / robots meta tag: The Complete Guide to Crawling and Indexing Control (robots.txt / noindex / X-Robots-Tag / data-nosnippet / rel) (upcoming wiki)
- Canonical / redirects: The Complete Guide to Canonical / Redirects / Site Migrations (including full HTTP status code table + 503 temporary outage playbook) (upcoming wiki)
- Internationalization (hreflang/locale): The Complete Guide to Internationalization (hreflang/multilingual/multi-regional) + Explicit Content (SafeSearch/Adult) (upcoming wiki)
- Image SEO: The Complete Guide to Rich Features / Discover / Images / Video / Page Experience / Web Stories / SXG / Paywall Google Images section
- Video SEO: The Complete Guide to Rich Features / Discover / Images / Video / Page Experience / Web Stories / SXG / Paywall video section
Last updated
2026-05-17 — Compiled based on Google Search Central's 7-part sitemaps series (latest as of 2025-12). Includes the latest field set after the spring 2022 extension cleanup.
Sources and related materials
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/overview?hl=en
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/overview?hl=zh-cn
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap?hl=en
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap?hl=zh-cn
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/large-sitemaps?hl=en
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/large-sitemaps?hl=zh-cn
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/combine-sitemap-extensions?hl=en
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/combine-sitemap-extensions?hl=zh-cn
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/image-sitemaps?hl=en
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/image-sitemaps?hl=zh-cn
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/video-sitemaps?hl=en
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/video-sitemaps?hl=zh-cn
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap?hl=en
- https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap?hl=zh-cn