Add a sitemap.xml to your Vite, Lovable or React app
A sitemap.xml is a list of your public page addresses that helps Google find them. Single-page apps built with Vite, Lovable or Bolt usually ship without one, and Lovable's docs say it creates a sitemap "not always".
Write a small public/sitemap.xml with the full https:// address of each public page, add a Sitemap: line to robots.txt, deploy, and submit it in Search Console.
A sitemap for a small app
<?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-10-27</lastmod></url>
<url><loc>https://www.example.com/pricing</loc></url>
<url><loc>https://www.example.com/about</loc></url>
</urlset>
Google's rules that matter for a small site:
- "Use fully-qualified, absolute URLs in your sitemaps", so
https://www.example.com/pricing, never/pricing. - Post it at the site root, "which is where we recommend posting your sitemaps"; a root sitemap can cover every file on the site.
- One sitemap can hold up to 50,000 URLs or 50MB uncompressed.
- List only public pages people should find: not
/dashboard,/adminor sign-in screens. - Use your custom domain, not a
lovable.apporvercel.appaddress.
Where to put it
- Vite, Lovable, Bolt:
public/sitemap.xml. Vite servespublic/files from the root, so it is published at/sitemap.xml. - Make sure your host serves the file. Open
https://www.example.com/sitemap.xmlafter deploying. If you see your app's homepage instead of XML, a catch-all rewrite is answering first; on Netlify real files win over a/*rewrite by default, so check the file reached your build output.
Tell Google about it
Add one line anywhere in public/robots.txt:
Sitemap: https://www.example.com/sitemap.xml
Then submit the address in Search Console's Sitemaps report. Google calls a sitemap "merely a hint", so it helps discovery rather than forcing indexing.
"Sitemap could not be read"
Search Console's help suggests making sure "your sitemap is not blocked by robots.txt, is valid". Check that the URL returns XML (not HTML), that it starts with <?xml and <urlset, and that every <loc> is an absolute URL on the same host.
What Pewterkit Check looks for
A free check requests /sitemap.xml and reads your robots.txt. It is happy with either a sitemap file that is real XML (<urlset> or <sitemapindex>) or a Sitemap: line in robots.txt, and notes when neither is there.
FAQ
Does a one-page app need a sitemap?
It is optional: Google calls a sitemap a hint. It earns its place once you have several public pages, such as pricing, features or blog posts, that you want found.
Can Lovable make the sitemap for me?
Lovable's SEO review can flag a missing sitemap with an Add a sitemap finding. Check the result lists only real public routes on your custom domain.
Should lastmod be today's date on every page?
Use the date each page last really changed. If you don't track that, leave lastmod out.
Where does the sitemap go in robots.txt?
Google says to insert the Sitemap: line "anywhere in your robots.txt file".
Sources
- Google Search Central: Build and submit a sitemap — read 27 Oct 2026: example, absolute URLs, limits, root location, robots.txt line, a hint
- Search Console Help: Page indexing report — read 27 Oct 2026: "Google can't access my sitemap"
- Lovable docs: Automatic SEO features — read 27 Oct 2026: sitemap "not always" created, Add a sitemap finding
- Vite: Static Asset Handling, the public directory — read 27 Oct 2026: public files served at /
- Netlify: Rewrites and proxies (shadowing) — read 27 Oct 2026: existing files are served before a /* rewrite by default
How this page was made: drafted with AI from the sources listed, reviewed by Pewterkit. Docs checked Oct 27, 2026. Spotted something out of date? Tell us.