On this page
What this issue is
An XML sitemap is a file that lists the URLs you want search engines to crawl. It follows a strict format. If the format is broken, a crawler cannot read it. Two faults are common: malformed XML (an unclosed tag, an unescaped &, text before the first tag) and a wrong or missing namespace (the xmlns value on the root element).
<?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>2025-01-15</lastmod>
</url>
</urlset>Why it costs you leads or sales
If a search engine cannot parse your sitemap, it falls back on following links. New landing pages, product pages and offers may be found later, or missed if they are poorly linked. Pages that are not indexed cannot bring in organic leads or sales. The effect is usually gradual, which is why it goes unnoticed. Your site still loads and your forms still work.
- New page publishedLanding page goes live
- Sitemap readInvalid XML or wrong namespace
- Page discoveredOnly through links, if at all
- Indexed and rankedDelayed or missing
- Organic leadForm never sees the visitor
The break sits at the sitemap read step; everything after it slows down or is lost.
How to check if your site has it
Open the sitemap in a browser
Go to /sitemap.xml (or /sitemap_index.xml, /wp-sitemap.xml). You should see a tree of URLs or a note that the file has no style information. A blank page, an HTML page or a visible error message is a red flag.
View the page source
Right-click, then View page source. The first characters must be
<?xml. Any blank line, warning text or HTML before it can break parsing.Check the root tag
Confirm it reads
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">or<sitemapindex ...>with the same namespace. Look for typos, a missingxmlns, orhttpsin the namespace.Look at Search Console
In Google Search Console open Indexing, then Sitemaps. Statuses such as 'Couldn't fetch' or 'Sitemap could not be read', or an error about parsing, point to this problem. Check Bing Webmaster Tools Sitemaps too.
Validate the file
Run the file through an XML validator or a sitemap validator. From a terminal,
xmllint --noout sitemap.xmlreports the line of any syntax error.
curl -s https://www.example.com/sitemap.xml -o sitemap.xml
head -c 200 sitemap.xml
xmllint --noout sitemap.xml && echo "XML is well formed"
grep -o 'xmlns="[^"]*"' sitemap.xml | head -1| Cause | What you see | Typical source |
|---|---|---|
Text or warnings before <?xml | Parse error on line 1 | PHP notice, extra blank line in a theme file |
Unescaped & in a URL | Parse error mid-file | Hand-built or custom sitemap |
| Wrong or missing xmlns | Namespace error or zero URLs read | Hand-edited file, old generator |
| HTML returned instead of XML | Page looks like your site | Caching, security plugin or redirect to a page |
| Wrong content type | Downloads or shows as text | Server config |
How to fix it
Where possible, let your platform generate the sitemap instead of editing it by hand. Then remove whatever is polluting the output.
Find which plugin builds the sitemap
Yoast SEO, Rank Math, All in One SEO and WordPress core (/wp-sitemap.xml) can all do it. Use one only.
Clear stray output
Turn on WP_DEBUG_LOG (not display) so PHP notices go to a log file instead of the page. Check functions.php and mu-plugins for closing
?>tags followed by blank lines.Test with plugins off
Disable caching, minify and security plugins one by one and reload the sitemap. Some inject comments or HTML. Then purge caches.
Refresh permalinks
In Settings, then Permalinks, click Save Changes to rebuild rewrite rules if the sitemap URL returns a page instead of XML.
Leave the sitemap as generated
Shopify builds /sitemap.xml automatically and you cannot edit it. A valid file is expected.
Check what you submitted
Make sure Search Console has your primary domain's /sitemap.xml, not a custom or copied file.
Check for a proxy or app
If a redirect or an app rewrites the sitemap path, remove it under Online Store, then Navigation, URL redirects.
Use the automatic sitemap
In Site settings, then SEO, turn on Auto-generate sitemap and publish.
Remove a custom upload
If you pasted a custom sitemap, delete it. Hand-written XML is the usual source of namespace errors here.
Rely on the built-in sitemap
Wix generates /sitemap.xml. It cannot be edited, so resubmit it in Search Console and wait for a re-read.
Check page SEO settings
Pages hidden from search are left out; that is a different issue from invalid XML.
Use the generated sitemap
Squarespace creates /sitemap.xml automatically. It cannot be edited.
Check for domain redirects
Confirm the sitemap URL on your primary domain returns XML and is not redirected to an HTML page.
Set the right root and namespace
Use
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">exactly. Start the file with the<?xml version="1.0" encoding="UTF-8"?>declaration and nothing before it.Escape special characters
In URLs write
&as&,<as<, and>as>. Use a proper XML library to build the file instead of string concatenation.Send the right header
Serve it with
Content-Type: application/xmlortext/xml, and save the file as UTF-8 without a byte order mark.
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.example.com/sitemap-pages.xml</loc>
</sitemap>
</sitemapindex>Invalid
- Warning text before `<?xml`
- `xmlns` missing or misspelled
- `&` unescaped in a URL
- Returns an HTML page
Valid
- File starts with `<?xml`
- Namespace is the sitemaps.org 0.9 address
- Special characters escaped
- Served as XML and read by Search Console
How to confirm it's fixed
- The sitemap URL loads as XML with no text before
<?xml xmllint --nooutor an XML validator reports no errors- The root tag has
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" - The response header is
application/xmlortext/xmlwith status 200 - Search Console shows status Success after you resubmit it
- Bing Webmaster Tools reads the file with no errors
How to prevent it happening again
- Generate the sitemap with your platform or a maintained plugin, not by hand
- Run only one sitemap generator at a time
- Re-validate after theme, plugin, caching or CDN changes
- Keep PHP and server errors out of page output in production
- Check the Sitemaps report in Search Console after each major release
- Turn on email notifications in Search Console and Bing Webmaster Tools
Day 1
A plugin update prints a PHP notice at the top of the sitemap.
Day 3
Search Console marks the sitemap as unreadable. Nobody opens the report.
Week 3
New landing pages are still not indexed.
Week 4
Notice removed, sitemap resubmitted and read successfully.
How FunnelGuard handles this
FunnelGuard does not check sitemap XML or namespaces yet. It is a possible future check, not a current feature. FunnelGuard is a synthetic monitoring service: a robot visitor runs your real customer journeys, such as lead forms, checkouts and booking buttons, and checks each step, the tracking hits and whether test leads arrive.
That covers what happens after a visitor lands on your site, so it will not tell you that a sitemap is unreadable. To watch for this, use the Sitemaps report and email notifications in Google Search Console and Bing Webmaster Tools, and run a validator or xmllint after releases. A free read-only website audit from FunnelGuard is also available, but do not rely on it for sitemap validity.
Questions people ask
Why does Google Search Console say my sitemap could not be read?
The file usually has malformed XML, a wrong namespace, or returns HTML instead of XML. Open the sitemap URL, view the source, and check that it starts with <?xml and a correct urlset tag. Then open the error details in Search Console for the exact line.
What is the correct namespace for an XML sitemap?
The namespace is http://www.sitemaps.org/schemas/sitemap/0.9. It goes in the xmlns attribute of the root <urlset> or <sitemapindex> tag. Use http, not https, in that value.
How do I validate my sitemap XML?
Use an online XML or sitemap validator, or run xmllint --noout sitemap.xml in a terminal. Also resubmit the sitemap in Google Search Console and check that its status shows Success.
Why does my WordPress sitemap show a blank page or an error?
Often a plugin conflict, a PHP notice or a caching layer is altering the output. Check that only one plugin makes the sitemap, hide PHP errors from page output, purge caches, and resave Settings, then Permalinks.
Do I need to escape ampersands in sitemap URLs?
Yes. In XML, write & as & inside <loc>. An unescaped ampersand makes the file malformed and can cause the whole sitemap to fail to parse.
Can I edit the sitemap on Shopify, Wix or Squarespace?
No. These platforms generate the sitemap automatically and it cannot be edited. If it looks invalid, check for redirects, apps or domain settings that alter it, and resubmit it in Search Console.
Does FunnelGuard check if my sitemap is valid?
Not yet. Sitemap validation is a possible future check. For now, use Search Console, Bing Webmaster Tools and an XML validator to watch it.
Related issues
- SEO-102Sitemap returns 404 or 5xxFix guide
- SEO-099No XML sitemapFix guide
- SEO-101Sitemap not submitted in Search Console / Bing WebmasterFix guide
- SEO-113Plugin generates duplicate sitemaps (Yoast plus Rank Math)Fix guide
- SEO-105Sitemap lists 404, redirect, noindex or canonicalised URLsFix guide
- SEO-106Sitemap lists staging or wrong-domain URLsFix guide