Overview
Static sitemaps work for simple sites, but if your app has dynamic content (blog posts, products, user profiles), you need a sitemap that updates automatically. This guide shows you how to create a dynamic sitemap using Supabase Edge Functions in your Lovable project — no manual coding required. Just paste one of the prompts below into Lovable and customize the placeholders.When You Need a Dynamic Sitemap
- Blog or content site with new posts
- E-commerce with product pages
- Directory or listing site
- Any app where pages are created from database records
Prerequisites
- A Lovable project connected to Supabase
Step 1: Choose the Right Prompt
Pick the prompt that best matches your site, then customize the placeholders (marked with[BRACKETS]) before pasting it into Lovable.
Static-Only Sitemap (no database content)
Static-Only Sitemap (no database content)
Use this if your site has no database-driven pages — just fixed routes like
/about, /pricing, etc.Hybrid Sitemap (static pages + some dynamic Supabase content)
Hybrid Sitemap (static pages + some dynamic Supabase content)
Use this if your site has static pages and some dynamic content from Supabase (under 1,000 items per entity).
Backend Function Sitemap (large datasets)
Backend Function Sitemap (large datasets)
Use this if you have 1,000+ records across your entity types (up to 50,000 total URLs).
Paginated Sitemap (over 50,000 URLs)
Paginated Sitemap (over 50,000 URLs)
Use this if your total URL count exceeds 50,000 and you need paginated sub-sitemaps.
Step 2: Verify the Edge Function
After Lovable generates and deploys the code, verify it’s working:- Open your app’s
sitemap.xmland confirm all static URLs or edge function URLs are listed - Visit each edge function URL in the sitemap index — each one should return valid XML with your pages
Step 3: Proxy the Sitemap Through Your Domain
Search engines prefer sitemaps served from your own domain. Use Hado SEO’s routing rules to proxy/sitemap.xml to your Supabase Edge Function — no code changes needed.
Open Routing Rules
In your Hado SEO Dashboard, select your domain and go to the Routing Rules tab.
Add a proxy rule
Click Add Rule and configure:
| Field | Value |
|---|---|
| Rule Type | Proxy |
| Source Path | /sitemap.xml |
| Target URL | https://YOUR_PROJECT_REF.supabase.co/functions/v1/sitemap |
| Priority | 10 |
Routing rules are processed by Hado SEO’s proxy before your app is hit. The request is forwarded to your Supabase function and the response is returned under your domain — visitors and search engines see
yourdomain.com/sitemap.xml. Learn more in the Routing Rules documentation.Step 4: Test Your Sitemap
Browser Test
Visit your sitemap URL. You should see properly formatted XML.Google Search Console
- Go to Google Search Console
- Navigate to Sitemaps
- Submit your sitemap URL
- Check for any errors
Sitemap Best Practices
Keep sitemaps under 50,000 URLs
Keep sitemaps under 50,000 URLs
Google limits sitemaps to 50,000 URLs or 50MB. For larger sites, use the Backend Function Sitemap prompt above, which generates a sitemap index with paginated sub-sitemaps.
Update lastmod accurately
Update lastmod accurately
Only update
lastmod when content actually changes. Google may ignore sitemaps that update lastmod without real changes.Include only indexable pages
Include only indexable pages
Don’t include:
- Pages blocked by robots.txt
- Pages with
noindexmeta tag - Redirect URLs
- Login-required pages
Use proper URL encoding
Use proper URL encoding
Encode special characters in URLs:
&becomes&<becomes<>becomes>"becomes"'becomes'