Skip to content
Anand Bajrangi SEO consultant and author Get free SEO audit
Add as preferred source

XML Sitemap Explained: SEO Guide, Examples & WordPress Setup (2026)

XML Sitemap Explained

An XML sitemap is a file that lists the important URLs on a website in a format search engines can read. It helps crawlers discover pages, especially when a website is new, large, has many pages, or uses a complex structure. It is a useful part of technical SEO, but it does not guarantee that a page will be crawled, indexed, or ranked.

Think of an XML sitemap as a directory of the pages you want search engines to know about. It complements your navigation and internal links; it does not replace them. In this guide, you will learn how XML sitemaps work, what to include, how to create one in WordPress, how to submit it in Google Search Console, and how to fix common sitemap errors.

What Is an XML Sitemap?

An XML sitemap is a structured text file written in Extensible Markup Language (XML). It contains URLs and may include additional information such as when a page was last meaningfully updated. Search engines can use this information as a discovery and crawling hint.

A basic sitemap entry looks like this:

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

The loc element contains the page’s absolute URL. The optional lastmod element records the date the page was last significantly updated. Only publish a last-modified date when it reflects a real content change; changing a theme footer or automatically updating every date can make the signal less useful.

Why Is an XML Sitemap Important for SEO?

Search engines can discover pages by following links, but a sitemap provides another way to find URLs. It is especially helpful when:

  • Your website has many pages or a large product catalogue.
  • Your site is new and has relatively few external links.
  • Important pages are several clicks deep in the site structure.
  • You publish or update content frequently.
  • Your site contains videos, images, or international page versions that need additional sitemap information.

A sitemap is a discovery hint, not a ranking factor or an indexing guarantee. Google may decide not to index a URL because it is duplicate, low quality, inaccessible, or otherwise unsuitable. Good internal linking, useful content, correct canonical tags, and reliable server responses remain essential.

How Does an XML Sitemap Work?

A website owner or CMS creates the sitemap and makes it available at a public URL. The sitemap can be discovered through a line in robots.txt or submitted directly through Google Search Console. Search engines can then fetch the file, read its URL list, and consider those URLs for crawling.

  1. Generate: Your CMS or sitemap tool creates a list of eligible URLs.
  2. Publish: The sitemap is made available at a public URL on your website.
  3. Discover: Search engines find it through robots.txt or a sitemap submission.
  4. Process: The search engine fetches and parses the sitemap.
  5. Evaluate: URLs may be crawled and assessed for indexing based on many signals.

Submitting a sitemap does not force Google to crawl every URL immediately. You can monitor whether Google has processed the sitemap and what it reports about discovered URLs in Search Console.

What Should You Include in an XML Sitemap?

Include URLs that you want search engines to discover and that are suitable for indexing. For most websites, these are pages that return a successful response, represent the preferred canonical URL, and provide useful, unique content.

Good candidates to include

  • Your homepage and important category pages.
  • Useful service pages and location landing pages.
  • Original blog posts and evergreen guides.
  • Canonical product pages that are available to users.
  • Other valuable, indexable pages that support your website’s purpose.

URLs to leave out

  • URLs that redirect to another page.
  • Pages returning errors such as 404 or 5xx.
  • Duplicate or non-canonical URL variations.
  • Pages with a noindex directive.
  • URLs blocked from crawling when they are not intended for search discovery.
  • Private, account, cart, checkout, and internal search pages that should not appear in search results.

Avoid including a URL simply because it exists. A clean sitemap should represent the canonical pages you want considered for search, not every URL your website can generate.

Important XML Sitemap Tags

Tag Purpose Notes
<loc> Specifies the URL. Required for each URL entry.
<lastmod> Shows the last significant modification date. Optional; keep it accurate.
<changefreq> Historically described expected change frequency. Google ignores this field.
<priority> Historically described relative URL priority. Google ignores this field.

Do not spend time trying to set a special priority or changefreq value for Google. Google does not use these fields. Accurate lastmod data is more useful when it genuinely reflects meaningful updates.

XML Sitemap vs HTML Sitemap

Both sitemap types can help organise a website, but they serve different audiences.

XML sitemap HTML sitemap
Machine-readable XML file for search engine crawlers. Normal web page designed for visitors.
Lists canonical URLs and optional metadata. Provides clickable links grouped by topic or section.
Usually submitted through Search Console or referenced in robots.txt. Usually linked from site navigation or the footer.
Supports URL discovery. Supports navigation and content discovery for people.

A website can use both. An HTML sitemap can make it easier for visitors to find content, while an XML sitemap provides a structured URL list for crawlers.

XML Sitemap Size and Format Limits

According to the Sitemap protocol, an individual sitemap file is limited to 50,000 URLs and an uncompressed file size of 50 MB. If your sitemap is larger, split it into multiple sitemap files and create a sitemap index that lists those files.

A sitemap index looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://example.com/post-sitemap.xml</loc>
  </sitemap>
  <sitemap>
    <loc>https://example.com/page-sitemap.xml</loc>
  </sitemap>
</sitemapindex>

Large websites often use separate files for posts, pages, products, categories, or other content types. A sitemap index makes these files easier to manage and submit.

How to Find Your XML Sitemap

Common sitemap locations include:

  • https://example.com/sitemap.xml
  • https://example.com/sitemap_index.xml
  • https://example.com/wp-sitemap.xml

These are examples, not guaranteed paths. Open your domain’s /robots.txt file and look for a Sitemap: line, or check the settings in your CMS or SEO plugin. Use the exact sitemap URL your website currently serves.

How to Create an XML Sitemap in WordPress

WordPress includes a basic XML sitemap feature in modern versions. It is commonly available at /wp-sitemap.xml. SEO plugins such as Yoast SEO and Rank Math can generate more configurable sitemap indexes and separate sitemaps for different content types.

Option 1: Use the WordPress core sitemap

  1. Open your WordPress website in a browser.
  2. Add /wp-sitemap.xml to the domain.
  3. Check that the sitemap index loads successfully.
  4. Review the listed sitemap files and URLs.

Option 2: Use an SEO plugin

  1. Install or open your chosen SEO plugin.
  2. Find its XML sitemap settings.
  3. Enable the sitemap feature.
  4. Choose which public post types or taxonomies should be included.
  5. Open the generated sitemap URL and review the output.

Do not run multiple sitemap generators without a clear reason. Choose one primary setup, confirm the final sitemap URL, and check that it contains the correct canonical pages.

How to Submit an XML Sitemap in Google Search Console

Submitting a sitemap helps Google discover its location and monitor processing. You need access to the relevant Search Console property.

  1. Open Google Search Console.
  2. Select the correct website property.
  3. Open Sitemaps in the Indexing section.
  4. Enter the sitemap path or full URL in the submission field.
  5. Submit it and check the reported status.
  6. Return later to review whether Google processed the sitemap and how many URLs it discovered.

A successful submission means Google could access and process the sitemap; it does not mean every listed page is indexed. Use URL Inspection to investigate individual URLs when needed.

How to Add a Sitemap to Robots.txt

You can make the sitemap location easier for crawlers to discover by adding a sitemap directive to your robots.txt file:

User-agent: *
Disallow:

Sitemap: https://example.com/sitemap_index.xml

Replace the example with the exact live sitemap URL. A sitemap can also be submitted in Search Console; using both methods is fine. For more information, see our guide to robots.txt explained.

Common XML Sitemap Errors and How to Fix Them

1. Submitted URL returns an error

Check whether the sitemap URL is accessible, returns a successful HTTP response, and serves valid XML rather than an error page or HTML login screen.

2. URLs are blocked by robots.txt

Review the relevant crawling rules. Do not list URLs in the sitemap if you intentionally prevent search engines from crawling them.

3. Sitemap contains noindex pages

Remove URLs that have a noindex directive. A sitemap should not tell search engines that a page is a preferred indexing candidate while the page itself asks not to be indexed.

4. Redirected or broken URLs are included

Update the sitemap to list the final canonical URL, not an old redirect or a URL that returns an error.

5. Duplicate URL versions appear

Use consistent HTTPS, hostname, trailing-slash, and canonical URL formats. Do not mix alternate versions of the same page without a specific reason.

6. The sitemap is too large

Split large URL lists into multiple sitemap files and reference them from a sitemap index. Respect the 50,000-URL and 50 MB uncompressed limits for each file.

7. Last-modified dates are inaccurate

Update lastmod only when the page’s main content has changed meaningfully. Avoid changing every date automatically on a daily schedule.

8. Sitemap is not updating

Check plugin settings, caching, server responses, and whether the generated sitemap reflects newly published or removed content. Clear relevant caches if needed, then open the live sitemap again.

How to Audit an XML Sitemap

Include sitemap checks in your regular technical SEO process. A practical audit can follow these steps:

  1. Confirm the location: Check the sitemap URL in robots.txt and your SEO plugin.
  2. Check the response: Make sure the sitemap loads and contains valid XML.
  3. Review URL quality: Confirm entries are canonical, indexable, and return successful responses.
  4. Find exclusions: Identify noindex, blocked, redirected, duplicate, and error URLs.
  5. Compare coverage: Check whether important live pages are missing from the sitemap.
  6. Review Search Console: Investigate sitemap processing errors and URL indexing reports.
  7. Repeat after changes: Recheck after migrations, redesigns, URL changes, or major content updates.

For a large website, use a site crawler or sitemap validation tool to compare the sitemap URLs against the site’s status codes, canonical tags, and indexability settings.

XML Sitemap SEO Checklist

  • The sitemap is available at a public, stable URL.
  • It uses valid XML and the correct sitemap namespace.
  • It includes canonical, indexable URLs that return successful responses.
  • It excludes redirected, broken, duplicate, and noindex URLs.
  • It uses the preferred HTTPS and hostname version.
  • Its lastmod values reflect meaningful updates.
  • It stays within the sitemap size and URL limits.
  • A sitemap index is used when multiple sitemap files are needed.
  • The correct sitemap URL is referenced in robots.txt where appropriate.
  • The sitemap has been submitted and reviewed in Google Search Console.
  • Important pages are also discoverable through useful internal links.

Frequently Asked Questions About XML Sitemaps

1. Does every website need an XML sitemap?

Not every website needs one. Google can often discover pages through links. A sitemap is particularly useful for new, large, complex, or frequently updated websites.

2. Does submitting a sitemap guarantee indexing?

No. Submission helps Google discover URLs, but Google decides whether and when to crawl and index them. A sitemap is not a guarantee of inclusion in search results.

3. How often should an XML sitemap be updated?

It should update when important URLs are added, removed, or meaningfully changed. Most CMS and SEO plugins generate it automatically when content changes.

4. Should noindex pages be included in a sitemap?

No. Keep URLs with a noindex directive out of the sitemap. Include the canonical pages you want search engines to consider for indexing.

5. Can I have more than one XML sitemap?

Yes. Websites can use several sitemap files and combine them in a sitemap index. This is common for large websites and different content types.

6. What is the difference between a sitemap and robots.txt?

A sitemap lists URLs that you want search engines to discover. Robots.txt gives crawlers instructions about which URL paths they may request. They have different purposes and can work together.

7. Does Google use the priority and changefreq tags?

No. Google ignores the priority and changefreq fields. Keep meaningful last-modified dates accurate instead.

8. Where can I find my WordPress sitemap?

Try /wp-sitemap.xml for the WordPress core sitemap, or check your SEO plugin for its sitemap index URL. The exact path depends on your configuration.

9. Should image URLs be included in an XML sitemap?

Image sitemap extensions can provide additional information about images. Many websites also rely on images being discovered through their page HTML. Use image sitemap features when they add value to your site’s image discovery strategy.

Final Thoughts

An XML sitemap gives search engines a structured list of the important URLs on your website. It is most useful when it stays accurate, contains canonical and indexable pages, and is supported by strong internal linking and useful content.

Do not treat a sitemap as a shortcut to rankings or guaranteed indexing. Create it, check it, submit it in Search Console, and review it after important website changes. A clean sitemap is a simple but valuable part of a healthy technical SEO setup.

Official Resources

Share this article

LinkedIn X WhatsApp Email
Anand Bajrangi

Written by

Anand Bajrangi

SEO consultant, author and co-founder of EvolvCode Solutions

Anand is a self-taught SEO consultant from Bihar, India. He started learning SEO in 2020, and he and his team have since helped more than 100 businesses get found on Google. He wrote two books on SEO, The Truth About SEO and SEO Words Made Simple, and builds free SEO tools, a WordPress SEO plugin and the SEO Inspector Chrome extension.

See more of Anand’s articles on Google

Choose anandbajrangi.com as a preferred source, and Google will show you more of its articles in Top Stories and in “From your sources”.

Add as preferred source

Want Anand to look at your site?

Request a free SEO audit. You get a plain-English list of what to fix first, by email.

Get free SEO audit