Blog · 7 min read

How to create and submit an XML sitemap

Published

How to create and submit an XML sitemap

An XML sitemap is a file that lists the pages you want search engines to find. It does not guarantee ranking, but it helps Google discover new and updated pages faster, which matters most for new sites, large sites and pages with few links pointing to them.

The steps below work on any platform, whether you use WordPress, Shopify, Wix, Joomla or a custom-built site.

What goes in a sitemap

A sitemap is a plain XML file, usually at /sitemap.xml. Each page is one <url> entry with its address in <loc> and, ideally, the date it last changed in <lastmod>. A single file can hold up to 50,000 addresses and up to 50 MB uncompressed. Bigger sites split it into several files and list them in a sitemap index.

Include only pages you want in search results: indexable pages that return a 200 status, use the canonical address and are not blocked by robots.txt.

Step 1: check whether you already have one

Many platforms create a sitemap automatically. Try /sitemap.xml, /sitemap_index.xml and /wp-sitemap.xml on your domain. The robots.txt and sitemap tester looks for all of them, reads the Sitemap lines in your robots.txt and validates the file.

Step 2: create the sitemap

Step 3: upload it and add it to robots.txt

Place the file in the root of your site so it opens at https://yourdomain.com/sitemap.xml. Then add this line to your robots.txt so every crawler can find it:

Sitemap: https://yourdomain.com/sitemap.xml

Use the full address, with https and your preferred www or non-www version. The robots.txt generator adds the line for you.

Step 4: submit it in Google Search Console

  1. Open Search Console and choose your property.
  2. Go to Sitemaps in the left menu.
  3. Enter the sitemap path, such as sitemap.xml, and press Submit.
  4. Check the status. "Success" means Google read it. Open the report to see how many pages were discovered.

Bing Webmaster Tools has the same option, and Bing's index also feeds other search engines.

Common sitemap mistakes

Step 5: keep checking it

Test the sitemap again after site changes, migrations and redesigns, and look at the Search Console sitemap report for new errors. The on-page SEO checker helps you confirm that the pages you list have good titles, descriptions and canonical tags.

Common questions

Do small sites need a sitemap?

A small, well-linked site can be found without one. A sitemap is still free insurance and takes minutes, so most sites should have one.

Do priority and changefreq matter?

Google has said it ignores both. Accurate addresses and lastmod dates are what count.

How long until Google reads my sitemap?

Often within days, but the time varies. Submitting does not force indexing of every page.

Free tools for this problem

More guides