Skip to content
Desayuno SEO

Sitemap.xml: what it is, what to include and how to submit it to Google

· Published: ·Technical SEO

Translated from the Spanish original. Leer en español

Alejandro sits wrapped in a huge map of a website structure while three small robots plant flags on its pages. Headline: The map of your website, sitemap.xml.

Short answer. A sitemap is a file where you list the URLs you want Google to know about. It doesn't rank pages, but it speeds up discovery and helps schedule crawling. Every website should have one, and it is submitted in Search Console or with one line in robots.txt.

What is a sitemap.xml and what doesn't it do?

According to Google's documentation, a sitemap is a file where you provide information about the pages, videos and other files on your site, and the relationships between them. Search engines read it to crawl your website more efficiently.

In plain words: it is the list of URLs you consider important. Google can discover them in other ways, but the list saves it work and gives you a place to check what it sees.

What it doesn't do is just as important. A sitemap doesn't improve your position, doesn't force Google to index anything and doesn't fix a website with weak content. Putting a URL in the file is a suggestion, not an order. If a page isn't indexed, the sitemap is neither the cause nor the solution.

Why should every website have a sitemap, even a small one?

Here it is worth being exact about what Google says. On its sitemaps page it says that "you might not need a sitemap" if your site is small, meaning 500 pages or fewer (counting only those you want to appear in results), and if it is well linked internally. That is, for Google it is optional.

My criterion is different: I prefer to always add one. Three reasons:

  • It costs almost nothing. Google points out that most content management systems generate sitemaps automatically, or that there are plugins to do it.
  • It is your official list of important URLs. When you build it, you force yourself to decide which pages you really want on Google and which you don't.
  • It gives you diagnostics. The Sitemaps report in Search Console shows you when Google read the file and what errors it found. That works the same on a 20-page website as on a 20,000-page one.

Mind the difference between what Google says and what I do. Google doesn't require a sitemap on a small website. I add one anyway because the cost is minimal and the benefit, though small, is real.

A librarian robot hands a crawler robot a long list of pages, each with a green check mark
A sitemap is the list of pages you want Google to know about. Conceptual illustration.

Which URLs should go in the sitemap and which shouldn't?

The rule is simple: only URLs you want to see in search results. In practice, every URL in the sitemap should meet four conditions:

  1. It responds with a 200 code, without redirecting.
  2. It can be indexed: it has no noindex and isn't blocked.
  3. It is the canonical version of its content. If you don't remember what that is, there is the guide on the canonical tag.
  4. It is written as an absolute URL, with the full domain.

Google asks for it like this: in its guide to building sitemaps it says to use fully qualified, absolute URLs, because it will crawl them exactly as you write them. A relative path like /pagina.html isn't valid.

Out of the file: redirects, error pages, URLs with noindex, pages canonicalized to another one and internal search results. A sitemap full of URLs that can't be indexed is a list that lies, and a file that lies stops being useful for diagnosis.

An invented example to see it clearly: an online plant shop (fictional) has 300 products, 40 color and size filters that generate URLs, and 12 discontinued products that redirect to the category. The sitemap should include the 300 products and the categories. The filters and the redirects stay out.

A doorman robot lets pages with the 200 badge into a room called Sitemap and turns away those that redirect, have noindex or are broken
Only pages that respond 200 and can be indexed get in. Conceptual illustration.

Which format to choose: XML, RSS or text?

Google supports several formats and has no preference among them:

FormatWhat it is for
XMLThe most versatile. It supports extra data for images, video, news and language versions.
RSS, mRSS and Atom 1.0Very easy to offer because many CMSs create the feed on their own.
TextThe simplest: it only lists URLs of HTML pages and other indexable content.

If you cannot see all the columns, scroll the table sideways.

My default choice is XML. It is the one almost any tool generates, and if tomorrow you add images or versions in another language, it is already prepared.

A minimal XML sitemap is a <urlset> container with one <url> entry per page. Each entry carries <loc> with the absolute URL and, if you want, <lastmod> with the date of the last significant modification, for example 2026-10-13.

The file must be encoded in UTF-8. It is advisable to place it at the root of the domain, because a sitemap in a folder only affects what hangs from that folder, unless you submit it through Search Console.

What about lastmod, priority and changefreq?

Here there is more noise than anywhere else on the topic. Google's answer is in its June 2023 announcement and in the sitemaps guide:

  • lastmod does matter. Google says it uses it as a signal to schedule the crawling of URLs it already knew, as long as it is in a valid date format and matches reality. If you say something changed yesterday and it changed seven years ago, it will end up not believing you.
  • The last significant modification counts. Changing the main text, the structured data or the links justifies updating the date. Tweaking a line in the footer doesn't.
  • priority and changefreq are ignored. Google ignores the values of those two tags. If your plugin fills them in, nothing happens, but don't waste time configuring them.

The practical consequence: don't put today's date on all URLs every time the sitemap is regenerated. It is the most common mistake and it leaves worthless the only field Google does read.

Two panels of calendars: on the left all with the same date OCT 14 and a red cross, on the right with different dates and a green check mark
A lastmod date that doesn't match reality stops being useful. Conceptual illustration.

How big can a sitemap be?

According to Google, a sitemap is limited to 50 MB uncompressed or 50,000 URLs. If you exceed it, you have to split it into several.

To manage them, you use a sitemap index file: a sitemap that lists other sitemaps. You can submit a single index to Google, and up to 500 indexes per site in Search Console. Splitting by content type (products, categories, articles) has an extra advantage: you can see the performance of each file separately.

How do you submit the sitemap to Google?

"Submitting" a sitemap means telling Google where it is. It isn't uploaded anywhere. Search Console explains it like this, and there are two main ways:

  1. Sitemaps report in Search Console. You need owner permissions on the property. You paste the file's URL and Google shows you when it read it and what errors it found.
  2. A line in robots.txt. You add Sitemap: followed by the full URL. Google will find it the next time it crawls that file. You can add several lines. If you want to review how that file works, there is the article on robots.txt.

There is a third, the Search Console API, for those who want to automate it.

A warning: the old "ping" to Google to announce a new sitemap no longer works. Google retired it and those requests return a 404. If a plugin tells you it "notifies Google", that part does nothing.

What is worth doing is to stop thinking of "submitting" as a formality done once. Once submitted, Google rereads the file on its own. There is no need to resubmit it every time you publish a page.

How do you review your sitemap in 10 minutes?

This is the review I would do on any website:

  1. Open it in the browser. Type yourdomain.com/sitemap.xml. If it doesn't exist, first look in robots.txt for a Sitemap: line.
  2. Check that it responds with 200 and that it isn't behind a login or blocked by robots.txt.
  3. Compare with reality. Take 10 random URLs from the file and open them. All must respond 200, without redirecting, and point to themselves as canonical.
  4. Look for what is missing. Check that your most important pages are inside. If the sitemap doesn't include your services page, the problem is the generator.
  5. Look at lastmod. If all the dates are equal and recent, the generator is putting the current date. Fix it.
  6. Open the Sitemaps report in Search Console. Look at the date of the last read, the number of discovered URLs and the errors. If you don't know where to go next in Search Console, this guide puts in order what to look at.

If your website is made with a static generator or a modern framework, this applies the same: the sitemap has to be checked, not taken for granted. In the article on Astro I explain why a fast website doesn't guarantee healthy SEO.

If you prefer that I review the crawling and indexing of your website, you can see what my technical SEO service includes.

Frequently asked questions

Is a sitemap mandatory according to Google?

No. Google says you might not need one if your site is small (500 pages or fewer) and well linked. Even so, my recommendation is to always add one.

Do I have to resubmit it every time I publish?

No. Once submitted, Google rereads it on its own. What the file should do is update itself when you publish or change something, and reflect it in lastmod.

Can I have more than one sitemap?

Yes. Google allows submitting several sitemaps and several index files. Splitting by content type lets you see the performance of each separately in Search Console.

What do the errors in the Sitemaps report mean?

Search Console tells you if it couldn't read the file or if it found a problem processing it. Start with the basics: the sitemap URL responds 200, it isn't blocked and the format is valid.

Does my CMS generate the sitemap on its own?

Many do. Google points out that most content management systems generate them automatically. Even so, open the file and check it with the list above, because it existing doesn't mean it is right.

Sources

More editions

See all editions

Tell me about your project

The first call is free and with no commitment. I tell you what I would do on your site and whether it makes sense to work together.