Skip to content
EN · $
Panel Login Buy Package
Technical SEO

What Is an XML Sitemap, How Is It Created and Submitted?

6 min read

An XML sitemap is a file that presents a list of the important addresses on your site to search engines in a machine-readable format. Bots usually find your pages by following links; a sitemap speeds up this discovery, especially for new, large, or weakly interlinked sites. In this article we walk step by step through what a sitemap is, which addresses it should contain, how to create it, how to submit it to Google Search Console, and the common mistakes.

What is an XML sitemap?

A sitemap is an XML file, usually placed in the root directory under the name sitemap.xml, that contains one address per entry. An optional last-modified date (lastmod) can also be given for each address. The purpose of the file is not to issue a "add this to the index" command, but to offer a hint that says "these addresses are important to me, please look at them." There is no guarantee that Google will crawl and index every address listed in the sitemap.

A sitemap should not be confused with HTML "site map" pages prepared for people. An HTML map provides navigation convenience for visitors; an XML sitemap is intended for bots only.

Do you really need a sitemap?

According to Google's guidelines, a sitemap is not mandatory for a small, well-linked site. Even so, it provides real benefit in these situations:

  • If your site is new and receives very few links from outside.
  • If it has a large number of pages (thousands of products, articles, or listings).
  • If you have weakly connected or "orphan" pages.
  • If you have image, video, or news content (there are dedicated sitemap types for these).
  • If you publish content that changes frequently and want changes to be noticed.

It does no harm; when prepared correctly, it also makes it easier to track the status of addresses in Search Console. For this reason we recommend creating one for almost every site.

The structure of a sitemap file

The simplest sitemap 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-11-01</lastmod>
  </url>
  <url>
    <loc>https://www.example.com/blog/first-post</loc>
    <lastmod>2026-10-20</lastmod>
  </url>
</urlset>

The rules, briefly:

  • Each file can contain at most 50,000 addresses, and its uncompressed size cannot exceed 50 MB.
  • Addresses must be absolute (full addresses starting with https://) and must be on the same domain as the file.
  • The file must be UTF-8 encoded; special characters (such as &) must be escaped according to XML rules.
  • If you exceed the limit, create several sitemaps and list them in a sitemap index file (sitemapindex); you only need to submit the index file to Google.

priority and changefreq: Google ignores these two tags; filling them in is a waste of time. lastmod is useful only if it is updated when the page content really changes. A lastmod that shows "today's date" on all pages every day loses its reliability.

A sitemap index file has a similar format; it simply uses the sitemapindex tag instead of urlset, and the sitemap tag instead of url, with each line containing the address of a child sitemap file. On large sites, logical divisions such as "products-1.xml," "categories.xml," or "articles.xml" make both management and reporting in Search Console easier. For example, if indexing rates are low only in the product sitemap, you will quickly see that the problem lies in the product template.

Which addresses should go in the sitemap?

The golden rule: include only the addresses you want to appear in the index, that return 200 and that canonical to themselves. This makes the sitemap a "list of your best pages."

Include in the sitemapDo not include in the sitemap
Home, category, product, and article pagesPages with a noindex tag
Addresses that return a 200 status codeAddresses returning 404, 410, or 5xx
Addresses that canonical to themselvesPages that canonical to another page (parameterized copies)
A single, consistent address version (your https, www preference)Old addresses that redirect with 301/302
Pages with search valueCart, checkout, login, internal search results

If the concept of a canonical is unclear, read our canonical tag guide first. The sitemap, internal links, and canonical tags should all point to the same addresses; conflicting signals lead Google to make its own selection.

How is it created?

There are three common ways:

  1. Automatically, with a CMS or plugin. WordPress core generates a basic sitemap at /wp-sitemap.xml; SEO plugins offer more detailed and configurable versions. Platforms such as Shopify and Wix also generate them automatically. First check what your platform produces; there is no need to add a second sitemap.
  2. With a crawling tool. A desktop crawler such as Screaming Frog crawls the site and outputs a sitemap. It is practical for small, static sites, but you need to refresh it by hand as content changes.
  3. With code (dynamic). If you have your own software, the most sustainable solution is to pull addresses from the database and generate the sitemap on request or through a scheduled task. On large sites, split addresses by type (products, categories, articles) and gather them in an index file; this way you can see separately which section is indexed less.

Whichever method you choose, the file's Content-Type header must be XML and the server must return a 200 response. Open the generated output in a browser to check its format.

Image, video, news and multilingual sitemaps

A standard sitemap is sufficient for most sites. In some cases, types that carry additional information are useful:

  • Image sitemap: Helps you report images that are loaded with JavaScript or are hard to discover on pages. For the visibility of images in search, also see our image SEO guide.
  • Video sitemap: Specifies the video's title, description, thumbnail, and duration; useful for videos hosted on your own server or player.
  • News sitemap: Only for publishers eligible for Google News, and it lists articles published in the last two days.
  • Multilingual sitemap: If language versions need to reference each other, hreflang relationships can also be given inside the sitemap. Whichever method you choose, apply it consistently across all language versions.

Each of these types has its own tags and rules; if you do not need them, do not add complexity. First make sure the basic sitemap works properly, then expand when needed.

How to submit it to Google

  1. Add it to robots.txt. Write the line Sitemap: https://www.example.com/sitemap.xml anywhere in the file. For details, see our robots.txt guide.
  2. Submit it in Search Console. Select your property, go to the Sitemaps section, enter the address of the file, and click "Submit." If setup has not been done yet, follow our Search Console getting-started guide.
  3. Monitor the status. On the same page, statuses such as "Success," "Couldn't fetch," or "Has errors," along with the number of discovered pages, are shown. If there is an error, click into the details and read the reason.

The sitemap "ping" address used in the past has been retired by Google; today, the way to trigger a refresh is to provide accurate lastmod values and submit it to Search Console.

After submitting, compare the number of discovered pages in the Sitemaps report with your actual address count. For example, if your site has 800 product pages and the report shows 650, you need to find the reason for the gap: are addresses missing from the file, or were some dropped by Google? This comparison is one of the most valuable ways to use a sitemap.

Common errors

  • Leaving redirected and deleted addresses in place. When old addresses stay in the list, Google receives inconsistent signals.
  • Mixing http and https, or www and non-www versions. Use a single version.
  • Listing addresses blocked by robots.txt. The bot cannot access the page, and Search Console shows a "Blocked by robots.txt" warning.
  • Exceeding the size limit. A file that exceeds the limit may produce an error; split the addresses across several files.
  • Fake lastmod. Changing the date without making any update reduces trust.
  • Treating the sitemap as the only solution. Internal links to important pages are a stronger discovery signal than the sitemap. For this, see our internal linking strategy article.

If the addresses in your sitemap are not entering the index, the cause is usually the page itself rather than the sitemap (quality, duplicate content, crawling issues). In such cases, look at the situations described in our Google indexing problems guide. For official details, you can review the Google Search Central sitemap documentation.

Once the sitemap is set up, develop a habit of regular checks. When you add a new section, change the URL structure, or move the site to another domain, validate the file from scratch. An old sitemap that falls out of step with the new structure is a silent loss that can go unnoticed for weeks.

Frequently asked questions

Does a sitemap improve my rankings?

Not directly. A sitemap only makes discovery and crawling easier; rankings depend on many factors such as content quality, links, and user experience.

How often should I update the sitemap?

If it is generated dynamically, it updates automatically when new pages are added or content changes. If you prepare it by hand, refresh it after every important publication.

Can I use more than one sitemap?

Yes. You can add several files to both robots.txt and Search Console, or gather them all into a sitemap index file.

What does a "Couldn't fetch" error mean?

Google could not reach the file: the address may be wrong, the server may be returning errors, access may be blocked, or the XML may be invalid. Open the file in a browser, confirm the 200 response and the correct XML format, then resubmit.

Conclusion

A good sitemap is short, clean, and up to date: it contains only the addresses you want indexed, which return 200 and point to their canonical addresses; it is declared in robots.txt and Search Console; and it shows real change dates. Do not stop after setting it up; reviewing the Sitemaps report once a month helps you catch problems early. To see the entire technical foundation in a single list, you can use our technical SEO checklist.

Is your keyword missing clicks?

HitBot generates real sessions that search for your target keyword, find your site and click it. The results accumulate in Search Console as impressions and clicks.

Other posts