An XML sitemap is a file that lists important URLs on your website so search engine crawlers can discover them more easily. It can be useful when a site is new, has many pages, or uses a structure that makes some content harder to find through links. A sitemap does not guarantee that a page will be crawled, indexed, or shown in search results. It gives crawlers a clear list of URLs to consider.
Creating one is usually straightforward. The more important task is keeping it accurate: a sitemap should point to pages you want search engines to index, not every URL your website can produce. This guide explains what to include, how to generate a sitemap, and how to troubleshoot common issues.
What an XML sitemap does and does not do
An XML sitemap is a structured file, commonly available at a URL such as example.com/sitemap.xml. It contains URLs and may include details such as when a page was last updated. Search engines can use that information to discover pages and revisit changed content.
It is different from an HTML sitemap, which is a page designed to help human visitors browse a website. You may use both, but they serve different audiences.
- It can help with discovery. A sitemap gives crawlers a direct list of URLs instead of relying only on links between pages.
- It can report useful structure. Large sites may use a sitemap index that points to separate sitemaps for different types of content.
- It does not replace internal links. Important pages should still be reachable through clear navigation and links from related content.
- It does not force indexing. Search engines decide whether a page belongs in their index based on their own systems and the page’s accessibility and quality.
Which pages belong in an XML sitemap?
Include the final, preferred URLs of pages you want search engines to consider indexing. For a small business website, that might include service pages, location pages, product pages, and useful articles. Each listed URL should load successfully and provide meaningful content.
Leave out URLs that are not intended to appear in search results. Common exclusions include:
- Pages marked noindex
- Admin, account, cart, or checkout pages that are private or transactional
- Duplicate versions of the same page
- URLs that redirect to another address
- Error pages and pages blocked from crawling
Check that each included URL uses the correct protocol and hostname, such as HTTPS and your preferred version of the domain. If an old URL redirects to a new one, update the sitemap to list the destination instead. Our guide to setting up website redirects correctly explains how to manage those changes.
Also check the page’s canonical URL, which indicates the preferred version when similar pages exist. The sitemap and canonical tag should agree. If the sitemap lists one URL while the page points search engines to a different canonical URL, you are sending conflicting signals.
How to create an XML sitemap
The best method depends on how your website is built. In many cases, the platform or an established SEO tool can generate and update the file automatically.
For a WordPress website
WordPress includes a basic XML sitemap feature. On many sites, you can check for it by visiting yourdomain.com/wp-sitemap.xml. SEO plugins may create their own sitemap or sitemap index, often at a different address. Since a plugin can replace or extend the default output, check its settings before submitting anything.
- Open your SEO plugin’s sitemap settings, if you use one.
- Enable the sitemap feature and choose which content types should appear.
- Exclude private, duplicate, or low-value content types where the settings allow it.
- Open the sitemap URL in a browser and confirm that it loads without an error.
Do not install a second sitemap plugin just because you cannot find the file. First check the plugin settings, your WordPress sitemap address, and whether a caching or security tool is interfering.
For a custom-built or other platform site
Some site builders and content management systems provide sitemap generation in their settings. Look for options labeled sitemap, search engine visibility, or SEO. If the platform generates the file automatically, verify its URL and review which pages it includes.
For a custom site, a developer can generate the sitemap from the same content source used to build the pages. This is usually safer than maintaining a long list by hand, especially when URLs change frequently. A small static site can use a sitemap generator, followed by a manual review before publishing the resulting file in the site’s public root directory.
Whatever method you use, open the sitemap URL after generation. A working sitemap should return a readable XML document or sitemap index, not a login screen, a browser error, or an unrelated web page.
Submit the sitemap and check that it works
Search engines may discover a sitemap on their own, but you can also submit its URL through the relevant webmaster tools for your site. The exact interface varies, so use the tool’s sitemap section and enter the full sitemap address. You can also reference the sitemap in your robots.txt file, which is a public set of crawling instructions for the domain.
After submission, check the reported processing status and any listed errors. A successful fetch means the tool could access the file; it does not mean every URL will be indexed. Review individual pages separately if a specific URL is missing from search results.
Run a quick review whenever you add a major section or change your site structure:
- Does the sitemap load at its expected address?
- Are the listed URLs on the correct domain and using HTTPS?
- Do important URLs return a successful page rather than a redirect or error?
- Are noindex pages, duplicate URLs, and private areas excluded?
- Does the sitemap agree with each page’s canonical URL?
Common XML sitemap problems and fixes
The sitemap URL returns an error
Confirm the address in your platform or SEO plugin settings. Then check whether a security rule, server configuration, or cache is blocking the request. In WordPress, changing permalink settings and saving them can refresh rewrite rules, but back up the site and avoid changing unrelated settings during troubleshooting.
The sitemap contains URLs that should not be indexed
Adjust the sitemap settings to remove the affected content type, then regenerate or refresh the file. If the URL is still publicly accessible, remember that removing it from the sitemap alone does not prevent crawling or indexing. Use the appropriate page-level settings or access controls for the result you want.
Important pages are missing
Check whether the pages are published, included in the selected content types, and allowed to be indexed. Some platforms exclude pages with noindex settings. Also make sure the pages link to one another through your site navigation or relevant content. A sitemap is a discovery aid, not a substitute for a logical site structure.
The sitemap lists redirected or non-canonical URLs
Update the source settings or generated sitemap so it lists the final preferred URL. When a domain, URL pattern, or platform changes, review the sitemap as part of the migration checklist. This helps prevent old addresses from lingering in the file.
Keep the sitemap useful over time
For most small websites, an automatically generated sitemap is easiest to maintain. Review it after installing or changing SEO tools, publishing a new content type, changing domains, or reorganizing URLs. You do not need to resubmit it every time you publish a page if the sitemap updates automatically and search tools can access it.
Think of the sitemap as an accurate inventory, not a ranking shortcut. Keep it focused on useful, indexable pages, make sure those pages are linked within the website, and investigate errors when they appear. That gives search engines a cleaner view of the content you actually want people to find.
