A glowing blue android in profile under a starry sky
Willis Web Design / 01 of 08

Home / SEO Tips / XML Sitemaps Guide

SEO Tips

XML Sitemaps Guide: Build, Submit And Extend

An XML sitemap is a file that lists the pages, images and videos on your website so Google can find them and see which ones you think matter. This guide explains Google's own sitemap rules in plain English: who needs one, the formats, the size limits, index files, image, video and news extras, and how to submit it.

What An XML Sitemap Does And Which Sites Need One

A sitemap is a file that lists the pages, videos and other files on your site, and how they relate to each other. Search engines read it to crawl your site more efficiently. It also tells them which addresses you consider important. A sitemap can carry extra details too: when a page was last updated, other language versions of a page, where the images on a page live, a video's running time and age rating, and a news article's title and publication date.

You Probably Need One If

  • Your site is large, so some pages may not be linked from anywhere else.
  • Your site is new and few other websites link to it yet.
  • You have lots of video or image content, or you appear in Google News.

You Might Manage Without If

  • Your site is small: around 500 pages or fewer that you want in search.
  • Every important page can be reached by links from the home page.
  • You do not have many image, video or news pages you want to show in search.

Google says most sites benefit from a sitemap anyway. It does not guarantee anything, though: a sitemap helps Google discover your addresses, but every page still has to earn its place. Many website systems, including WordPress, Wix and Blogger, already make one for you, so check before you build your own.

What this means for you: think of a sitemap as a safety net behind good internal linking, not a replacement for it. Our guide to links Google can and cannot follow covers the other half of the job, and how Google Search works shows where crawling fits.

XML Sitemaps Guide In The SEO Tips Map

Every part of the SEO tips, on one map. The page you are reading is highlighted.

Three Sitemap Formats And When Each One Fits

Google supports every format in the sitemaps protocol and has no favourite. Pick the one that fits how your site is built.

FormatWhat it can listGood pointsDrawbacks
XML sitemapPages plus image, video, news and other-language detailsThe most flexible and detailed; most systems and plugins create oneCan be awkward to maintain by hand on a large or fast-changing site
RSS, mRSS or Atom feedPages and video details only (no images or news)Your blog or shop system often makes a feed already; you submit the feed address as a sitemapFeeds usually only hold your newest addresses
Text fileWeb pages and other text pages only, one address per lineThe simplest to create and maintain, even on big sitesNothing but URLs; no dates, images or video

A text sitemap can have any name as long as it ends in .txt, and must contain nothing except addresses. Google accepts RSS 2.0 and Atom 1.0 feeds. For most business websites the XML format is the right choice because it can grow with you.

Sitemap Rules: Size, Encoding, Location And Addresses

Whichever format you use, Google's best practices are the same. Most problems in the Search Console sitemaps report trace back to one of these.

Size Limits

Each sitemap can hold up to 50,000 URLs or 50MB uncompressed, whichever comes first. Go over and you must split it into several files.

UTF-8 Encoding

The file must be saved as UTF-8. Special characters inside tag values, such as an ampersand, must be escaped.

Location

A sitemap only covers its own folder and the folders below it, unless you submit it in Search Console. Put it at the root so it covers the whole site.

Full Addresses

List complete URLs including https and the domain. Google crawls them exactly as written, so /about/ on its own is not enough.

Canonical Pages Only

List the addresses you want shown in search, ideally the canonical version of each page. For separate mobile and desktop pages, list one, or mark up both.

Honest Dates

Google ignores priority and changefreq. It uses lastmod only when it is consistently accurate, so change it for real edits to content, structured data or links.

The order of addresses in the file does not matter. You can also submit several sitemaps, which makes it easier to see in Search Console how each section of your site is doing.

What this means for you: a copyright year changing in your footer is not a reason to update lastmod. On every site I build, the date only changes when a page's content, schema or links change, which is one of the technical standards built into every new site.

How To Create A Sitemap In Four Steps

Start by deciding which addresses belong in it. If the same content can be reached at more than one address, list only the one you prefer. Then choose how to build the file.

  1. 01

    Check Your Website System

    WordPress, Wix, Blogger and many shop systems make a sitemap automatically. Search your system's help pages for "sitemap" before doing anything else.

  2. 02

    Write It By Hand For A Tiny Site

    For fewer than a few dozen addresses, a text editor is fine. File names must only use characters allowed in URLs. It soon gets tedious to keep up to date.

  3. 03

    Generate It For Anything Bigger

    The best option is software on your site that writes the list straight from your pages or database. Third-party generator tools exist, but Google notes its own list of them is old.

  4. 04

    Split It If It Gets Too Big

    Once you pass 50,000 addresses or 50MB, break the file up and list the parts in a sitemap index file, covered below.

A minimal XML sitemap with two pages looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.example.com/</loc>
    <lastmod>2026-10-01</lastmod>
  </url>
  <url>
    <loc>https://www.example.com/services/</loc>
  </url>
</urlset>

Each page sits in its own url block with a loc (the address) and, if you have an honest date, a lastmod.

Submitting Your Sitemap To Google

Telling Google about your sitemap is only a hint. It does not promise Google will download the file or use it. There are four ways to do it.

  • The Search Console sitemaps report. Submit the address once. The report then shows when Googlebot last read the file and any errors it found. Our Search Console guide walks through it.
  • The Search Console API. Useful if you manage many sites and want to submit sitemaps automatically.
  • Your robots.txt file. Add a line such as Sitemap: https://www.example.com/sitemap.xml anywhere in the file. Google picks it up next time it reads robots.txt, and you can add several lines. See the robots.txt guide for the full syntax.
  • WebSub, for RSS and Atom feeds. This broadcasts changes to search engines as they happen.

One Sitemap For Several Websites

If you run more than one site, you can keep all their sitemaps in one place, or even list several sites in one sitemap. Through Search Console you must verify that you own every site involved, then submit the sitemaps or an index file. Through robots.txt you make a separate sitemap for each site containing only that site's addresses, store them all in one place you control, and add a Sitemap line to each site's robots.txt pointing to its own file, even though it lives elsewhere.

What this means for you: submit once in Search Console and add the robots.txt line, then leave it alone. Resubmitting the same file several times a day does nothing; the guide to getting pages recrawled explains what actually helps.

Sitemap Index Files For Bigger Websites

When one sitemap is too big, split it into smaller sitemaps that each stay under the limits, then list them all in a sitemap index file. You submit the index, and Google finds the rest. The index follows the same protocol, so every sitemap rule above applies to it too.

  • The sitemaps listed must be on the same site as the index, unless you have set up cross-site submission.
  • They must sit in the same folder as the index, or a folder below it. An index at /public/sitemap_index.xml can list files in /public/ or /public/shared/, but not elsewhere.
  • One index can list up to 50,000 sitemaps, and you can submit up to 500 index files per site in Search Console.
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://www.example.com/sitemap-pages.xml.gz</loc>
    <lastmod>2026-10-01</lastmod>
  </sitemap>
</sitemapindex>

The required tags are sitemapindex (wrapping everything), sitemap (one per file) and loc (the file's address). The optional lastmod gives the date that sitemap file last changed, in W3C date format, and helps Google plan its crawling. Online shops reach these sizes far sooner than service sites, which is one reason sitemaps are part of my ecommerce SEO service.

Image, Video And News Sitemap Extensions

Extensions add extra tags to an ordinary sitemap. You can put them in a separate sitemap or add them to your main one; Google says either is fine. The general sitemap rules still apply, and robots.txt must not block anything you want indexed.

Image Sitemaps

These help Google find images it might otherwise miss, such as pictures loaded by JavaScript. Each url entry can hold up to 1,000 image:image tags, each with an image:loc giving the image address. Images on another domain, such as a content delivery network, are allowed if both domains are verified in Search Console. The old caption, title, geo location and licence tags are no longer supported. The image and video SEO guide covers the rest of image best practice.

Video Sitemaps

Required tags are a thumbnail address, a title, a description (up to 2,048 characters) and either the video file's address (content_loc, preferred) or a player address (player_loc, used for YouTube or Vimeo embeds). Neither may be the same as the page address. Optional tags cover duration (1 second to 8 hours), expiry date, rating from 0 to 5, view count, publication date, family-friendly status, country and platform restrictions, subscription, uploader, live status and up to 32 tags. Only list videos that are part of the page's main content. Every file must be reachable by Googlebot: not blocked by robots.txt, not behind a login or firewall, and served over normal HTTP rather than a streaming protocol. Google also accepts Media RSS feeds as an alternative, with their own required tags for the video, player, title (up to 100 characters), description and thumbnail.

News Sitemaps

For publishers in Google News. Only include articles published in the last two days, and keep adding to the same file rather than making a new one each time. Each url gets one news:news block, with up to 1,000 per sitemap. Required tags are the publication name (matching your name in Google News exactly), the language code, the original publication date and the article title as shown on your site, without your name, author or date.

Combining Extensions And Fixing Sitemap Errors

You can mix image, video, news and other-language details in the same sitemap. Declare each extension's namespace on the opening urlset tag, then place each extension's tags one after another inside the right url entry. The order after loc does not matter.

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
  xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
  xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
  xmlns:xhtml="http://www.w3.org/1999/xhtml">

The xhtml namespace is the one used for hreflang links to other language versions, which the international SEO guide explains. Be careful with size: combining extensions makes a sitemap much bigger, so watch the 50MB and 50,000 address limits.

When something goes wrong, the sitemaps report in Search Console lists the errors, and Google has a troubleshooting guide that explains each kind of error and how to fix it.

What this means for you: if your sitemap lists pages that redirect, return 404 or carry noindex, Google spends crawling time on addresses you do not even want in search. The Pro website audit checks your sitemap against what is really on your site. For more guides like this, browse the full SEO tips map.

Based on Google Search Central documentation: Learn about sitemaps, Build and submit a sitemap, Manage your sitemaps with a sitemap index file, Image sitemaps, News sitemaps, Video sitemaps and alternatives, Combine sitemap extensions, Ask Google to recrawl your URLs, Troubleshoot Google Search crawling errors. Licensed under CC BY 4.0. Rewritten in plain English by Willis Web Design; last checked 13 October 2026.

Questions

Questions About XML Sitemaps Guide

Does a sitemap make Google index all my pages?

No. Google is clear that a sitemap is a hint, not an instruction. It helps Google discover your addresses and shows which ones you care about, but there is no guarantee every page listed will be crawled or indexed. Pages still need to be useful, reachable and free of blocks such as a noindex tag. A sitemap simply removes one reason a good page might be missed.

Do I need a sitemap for a small website?

Possibly not. Google says sites of roughly 500 pages or fewer, with good internal links from the home page, can usually be found without one. In practice a sitemap costs almost nothing to produce and helps new sites with few links from elsewhere, so most website systems create one automatically. Every site I build includes an XML sitemap as standard, kept up to date on each change.

Should I set priority and change frequency in my sitemap?

There is no need for Google. It ignores both the priority and changefreq values. The lastmod date can be used, but only if it is consistently accurate, meaning it changes when the main content, structured data or links on the page change. Updating lastmod on every page each day, or when only a copyright year changes, teaches Google to ignore your dates.

Where should my sitemap live?

The root of your site, such as example.com/sitemap.xml, is best, because a sitemap there can cover the whole site. A sitemap in a folder only covers that folder and the pages below it, unless you submit it through Search Console. Add a Sitemap line to your robots.txt file pointing to it as well, so any search engine can find it without being told.

Is an empty news sitemap a problem?

No. News sitemaps should only list articles published in the last two days, so if you have not published recently the file may be empty for a while. Search Console may show an empty sitemap warning, but Google says an empty news sitemap causes no problems for Search. Keep updating the same file as new articles go live rather than making a new one each time.

How often should I resubmit my sitemap?

Only when it has changed in a meaningful way, and never several times a day. Once Google knows where your sitemap is, through Search Console or your robots.txt file, it will come back to it by itself. Resubmitting an unchanged file does not speed anything up. If you want one or two new pages crawled quickly, the URL Inspection tool in Search Console is the better route.

Next step

See where your website stands, free.

Run a free test of your current site, or call me for a straight answer about what you need.