Short answer: your app answered /sitemap.xml with its own home page. Most single-page apps send index.html for any address they don't know, so when there's no sitemap file, Google asks for XML and gets your app instead. Search Console then flags it as HTML, or as a sitemap that "could not be read". To fix it, make the file exist when you build, keep it out of the app's catch-all rule, point robots.txt at it, and resubmit. You can check it in 30 seconds with curl.
"Sitemap is HTML" is what people type into Google when this happens: all ten autocomplete suggestions fill in. Google's current help page for the Sitemaps report has no entry by that name, so below I quote the entries that fit. What follows about Google comes from Google's own help and Search Central pages, and what follows about each framework and host from its own docs, all checked on December 1, 2026.
What happened
Here's the whole story in four steps:
- Google asks for
https://example.com/sitemap.xml. - Your build has no file called
sitemap.xml. - Your host's rule for single-page apps sends
index.htmlinstead, with a 200 "OK" status. - Google expected XML and got
<!doctype html>.
That rule isn't a mistake. It's what makes links to your app's pages work. Netlify's version is one line, "typically the last rule listed":
/* /index.html 200
Vercel's guide for Vite apps says that without one, "deep linking won't work out of the box", and adds this rewrite:
{
"rewrites": [
{ "source": "/(.*)", "destination": "/index.html" }
]
}
The rule is right for your app's pages. It's wrong for a file that should exist and doesn't.
Check it in 30 seconds
Run these two lines with your own domain (in Windows PowerShell, type curl.exe instead of curl):
curl -sI https://example.com/sitemap.xml
curl -s https://example.com/sitemap.xml | head -c 300
A real sitemap looks like this:
content-type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
Your app looks like this:
content-type: text/html
<!doctype html>
<html lang="en">
No terminal? Open the address in your browser. If you see your home page, that's the problem. Do the same for /robots.txt: it should be a few plain lines like User-agent: *, not your app.
When I checked ours on December 1, /sitemap.xml answered Content-Type: application/xml.
What Search Console says
A submitted sitemap gets one of three statuses: "Success", "Has errors", or "Couldn't fetch" ("The sitemap could not be fetched for some reason."). Google's help page explains: "If the details page says Sitemap could not be read, then the fetch failed for one of these reasons".
The entries that fit an app answering with HTML:
- Unsupported format: "Your sitemap is not in a supported format." Google reads sitemaps in XML, text, RSS and Atom. An HTML page is none of these.
- Parsing error: "Google could not parse the sitemap's XML."
Other reasons it can't fetch a sitemap, from the same page:
- "The sitemap is blocked by your robots.txt file."
- "The URL provided for the sitemap is wrong" "(HTTP 404 error: sitemap not found at the address provided)"
- "There is low crawl demand for the sitemap"
Google keeps trying for a while, then gives up: "If a sitemap fetch fails, Google will try a few more times, but will eventually stop trying to read that sitemap." So fix it, then resubmit.
The fix for your stack
Next.js
Add app/sitemap.js (or .ts). Next.js turns it into /sitemap.xml, and it "is a special Route Handler that is cached by default":
// app/sitemap.js
export default function sitemap() {
return [
{ url: "https://example.com" },
{ url: "https://example.com/pricing" },
{ url: "https://example.com/blog/first-post", lastModified: "2026-11-30" },
];
}
And app/robots.js, with the sitemap line in it:
// app/robots.js
export default function robots() {
return {
rules: { userAgent: "*", allow: "/" },
sitemap: "https://example.com/sitemap.xml",
};
}
Next.js's own example adds changeFrequency and priority, but you can leave them out: "Google ignores <priority> and <changefreq> values." One thing to look at (my own tip): if a middleware file sends signed-out visitors to a login page, make sure it lets /sitemap.xml and /robots.txt through.
Vite + React
Put sitemap.xml and robots.txt in the public folder. Vite says files there are "served at root path / during dev, and copied to the root of the dist directory as-is." After npm run build, check that dist/sitemap.xml is there. A hand-written file goes stale when you add pages, so it's better to have a small script write it from your routes at build time. The prompt below asks your agent for exactly that.
Lovable
Lovable's docs: "Lovable creates a robots.txt with every new project, but not always a sitemap". Run the SEO & AI review (More → Analytics in the editor). It checks your sitemap and robots.txt, and Try to fix "asks Lovable to apply the changes." Then publish, because "Google reads the sitemap from your live site, so pages that exist only in unpublished code are not included." Lovable "can verify your site and submit your sitemap for you in chat."
Netlify
Netlify serves a real file before your rule: "By default, you can't shadow a URL that actually exists within the site." So if you still get HTML, either the file isn't in the folder Netlify publishes, or your rule ends in 200!. The ! forces the rewrite "even if a file matches the URL."
Vercel
The rewrite above sends every other address to index.html. If sitemap.xml is in your build output, it gets served (my reading: the same rule leaves your app's own script files alone). If a function makes your sitemap, put its rewrite first, since "Vercel applies the first rewrite that matches a request, so list specific paths before the catch-all":
{
"rewrites": [
{ "source": "/sitemap.xml", "destination": "/api/sitemap" },
{ "source": "/(.*)", "destination": "/index.html" }
]
}
Replit
Replit runs "a Lighthouse audit against the URLs in your deployment" after every publish. Its list of fixes the Agent applies includes "Add a robots.txt and a sitemap.xml".
Point robots.txt at it
Google: "Insert the following line anywhere in your robots.txt file":
Sitemap: https://example.com/sitemap.xml
"The sitemap URL must be a fully-qualified URL", and the file has to sit at the root: "A robots.txt file lives at the root of your site."
The addresses inside the sitemap need the same care: "Use fully-qualified, absolute URLs in your sitemaps." Keep them all on the domain the sitemap is on, or Search Console reports "URL not allowed": "Your sitemap includes some URLs that are at a higher level or different domain than the sitemap file." (My example: a sitemap on your own domain that lists your app's .lovable.app or .vercel.app addresses.)
Then resubmit
In the Sitemaps report, Google says: "Try to fix the problem and resubmit the sitemap to the report." The status should turn to "Success". After that, be patient: Google calls submitting a sitemap "merely a hint".
How our own sitemap is built
Our site, appmorphy.com, is the site of Morphy, the app I build for running coding agents side by side. It's Next.js, so its sitemap is an app/sitemap.js file, and its robots.js has the same shape as the example above, with our domain in it.
One choice in it is worth copying. A comment in our file says: "Only blog posts, use-case pages and formats carry lastModified, because only they have a real date". Every other page gets no date at all. That matches Google: it "ignores <priority> and <changefreq> values", and it uses <lastmod> only "if it's consistently and verifiably" accurate. A date that changes on every build isn't.
A prompt for your coding agent
Paste this into Claude Code, Codex or your builder's chat, in the project:
Search Console says my sitemap is HTML: /sitemap.xml returns the app's
index.html.
1. Find how this project is built and hosted, and why /sitemap.xml falls
through to the app (a missing file, a catch-all rewrite, or a forced
rule).
2. Generate sitemap.xml at build time from the public routes, with
absolute https URLs on my real domain, served as XML at /sitemap.xml.
No changefreq or priority; lastmod only where a page has a real date.
3. Make sure robots.txt is served as plain text and includes:
Sitemap: https://<my domain>/sitemap.xml
4. Keep the app's catch-all for real app routes, but not for these files.
5. Build, show me the first lines of both files from the build output,
and give me the curl command to confirm it on the live site.
Questions
Do I even need a sitemap? Not always. Google says you might not if your site is "small" ("about 500 pages or fewer") and well linked inside. But you might if "Your site is new and has few external links to it", which is most new apps. Google's summary: "in most cases, your site will benefit from having a sitemap."
Does it have to be called sitemap.xml? No. Google's own example line is Sitemap: https://example.com/my_sitemap.xml. Tell Google where it is in Search Console or with that robots.txt line.
Why "Couldn't fetch" when it opens fine in my browser? Check the reasons above: a robots.txt rule blocking it, a typo in the address you submitted, or low crawl demand on a new site. Google also says it "will continue trying to fetch and process the sitemap for a few days."
Does a sitemap get my pages on Google? It helps Google find them, but "it doesn't guarantee that all the items in your sitemap will be crawled and indexed."
Do changefreq and priority help? No: "Google ignores <priority> and <changefreq> values."
Related guides
- Crawled, currently not indexed, when Google reads the sitemap but leaves pages out
- Lovable SEO: what Googlebot sees, if your app was built with Lovable
- Lovable vs Claude Code, to move a builder's app to your own computer
- What vibe coding really costs
References
- Google: Sitemaps report, build and submit a sitemap, sitemaps overview, create a robots.txt file
- Frameworks: Next.js sitemap, Next.js robots, Vite's public directory
- Hosts and builders: Netlify rewrites and proxies, Vercel rewrites, Vite on Vercel, Lovable SEO and AI search, Replit SEO rating


