An XML sitemap (a sitemap.xml file) is a machine-readable list of your site’s URLs that tells search engines which pages you want in search results. It does not guarantee indexing, but it helps crawlers find new and updated pages faster. On WordPress, Rank Math creates it automatically; you then reference it in robots.txt and submit it in Google Search Console.
- 1Check if you already have one: try /sitemap_index.xml, /wp-sitemap.xml or /sitemap.xml.
- 2If not, create it with a plugin, in your CMS settings or with a generator.
- 3Add a Sitemap: line with the full address to robots.txt.
- 4Submit it in the Sitemaps report in Google Search Console.
- 5Check errors and the number of discovered URLs from time to time.
What an XML sitemap is and when you need one
Google defines a sitemap as a file where you provide information about the pages, videos and other files on your site and the relationships between them. According to Google, a sitemap is most useful for:
- large sites and online stores, where it is hard to make sure every page is linked from at least one other page,
- new sites that few or no external sites link to yet,
- sites with lots of video, images or news that should be visible in search.
A small site of about 500 pages or fewer that is well linked internally does not strictly need one. We still recommend it: on WordPress it is free, takes minutes to set up and lets you check in Search Console how the submitted pages are indexed.
What an XML sitemap looks like
A sitemap is a UTF-8 encoded text file. The simplest version 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-09-20</lastmod>
</url>
<url>
<loc>https://www.example.com/services/seo</loc>
<lastmod>2026-08-14</lastmod>
</url>
</urlset>- loc is the full, absolute URL of the page, including https:// and the domain. Google requires absolute URLs, not relative paths.
- lastmod is the date of the last significant change to the content. Google uses it only if it is consistently and verifiably accurate.
- priority and changefreq can be left out. Google ignores them.
How to create an XML sitemap
WordPress and Rank Math
Since version 5.5, WordPress generates a basic sitemap on its own at /wp-sitemap.xml. The Rank Math plugin creates a more detailed index at /sitemap_index.xml with separate files such as post-sitemap.xml for posts and page-sitemap.xml for pages. In its settings you choose which content types and taxonomies to include. By default Rank Math puts 200 URLs in one file. Check that the sitemap contains no pages you want to keep out of search results.
Other CMS platforms and online stores
Many modern CMS and ecommerce platforms generate a sitemap automatically and update it whenever content changes. If yours cannot, an extension or a developer can add it.
XML sitemap generator
An online generator or crawler follows the links on your site and builds a static sitemap.xml file that you upload to the server. This works for small static sites. The downside: the sitemap does not update itself, so you have to regenerate it after every new page, and a generator only finds pages that are linked.
Robots.txt and sitemap.xml: submitting to Google
Add a line with the full sitemap address to the robots.txt file in the root of your domain, for example Sitemap: https://www.example.com/sitemap_index.xml. The line can go anywhere in the file, and search engines that support sitemaps, including Google and Bing, can discover it there.
In Google Search Console, open the Sitemaps report, enter the address and submit. The report shows whether Google fetched the file, when it last did so and how many URLs it discovered. Google retired the old sitemap ping endpoint at the end of 2023. According to Google, submitting a sitemap is only a hint: it does not guarantee that Google will download it or use it for crawling.
How to test your sitemap
- Open the sitemap URL in a browser. It must load without errors and without a login.
- In Search Console, check its status and the number of discovered URLs.
- In the Page indexing report, filter to submitted pages to see why some are not indexed.
Limits and sitemap index files
A single sitemap can contain at most 50,000 URLs or 50 MB uncompressed. Split a larger site into several files (for example sitemap1.xml and sitemap2.xml) and combine them with a sitemap index file, which can reference up to 50,000 sitemaps. You then submit only the index in Search Console. The individual sitemaps must be in the same directory as the index or lower in the site hierarchy.
Common sitemap errors
- Noindex URLs: the sitemap says “index this page” while the meta tag says the opposite. Search engines get conflicting signals.
- Redirected and broken URLs: the sitemap should list only addresses that return status 200.
- Non-canonical URLs: versions with parameters, HTTP instead of HTTPS, or both with and without www. List only canonical URLs.
- Fake lastmod: if every page shows today’s date, the value is not accurate and Google has no reason to rely on it.
- Sitemap blocked in robots.txt or behind a login.
- Outdated sitemap after a migration: after a redesign or domain change, Search Console still holds a file with old addresses.
- Two sitemaps side by side: for example the WordPress core sitemap and a plugin sitemap. Keep only one active.
When to bring in an expert
Help is worth it when Search Console reports errors, a large share of submitted pages stays out of the index, you are planning a site migration or you run an online store with thousands of URLs. A sitemap is just one part of technical SEO. Our guide to on-page vs off-page SEO covers what else to check on each page, a website SEO audit reveals the overall state of your site and the article on website speed and Core Web Vitals focuses on performance. You can hand sitemap and technical SEO checks over as part of website maintenance or our SEO services. Tell us what you need help with.
Frequently asked questions
What is sitemap.xml?
How do I find my website’s sitemap?
How do I add a sitemap to robots.txt?
Does a small website need an XML sitemap?
How do I test a sitemap XML file?
How many URLs can one sitemap contain?
Sources
Written by
Peter Gáborík
Founder of WebOptim and digital marketing specialist with a focus on web trends and SEO strategies.
Related service



