Skip to main content

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)

Use this if your site has no database-driven pages — just fixed routes like /about, /pricing, etc.
Use this if your site has static pages and some dynamic content from Supabase (under 1,000 items per entity).
Use this if you have 1,000+ records across your entity types (up to 50,000 total URLs).
Use this if your total URL count exceeds 50,000 and you need paginated sub-sitemaps.
Google only follows one level of nesting in sitemap indexes. Since your static sitemap.xml is a <sitemapindex> pointing to another <sitemapindex> (the edge function), Google won’t discover the paginated sub-sitemaps. You must proxy /sitemap.xml to your /functions/v1/sitemap edge function using Hado SEO’s routing rules (see Step 3 below) so that Google sees the paginated sub-sitemaps directly.
Replace all [BRACKETS] with your actual values before pasting into Lovable. For example, replace [YOUR_DOMAIN] with https://myapp.com and list your real pages and entity types.

Step 2: Verify the Edge Function

After Lovable generates and deploys the code, verify it’s working:
  1. Open your app’s sitemap.xml and confirm all static URLs or edge function URLs are listed
  2. 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.
1

Open Routing Rules

In your Hado SEO Dashboard, select your domain and go to the Routing Rules tab.
2

Add a proxy rule

Click Add Rule and configure:
3

Verify

Visit https://yourdomain.com/sitemap.xml in your browser. You should see the XML output from your Supabase function, served from your own domain.
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

  1. Go to Google Search Console
  2. Navigate to Sitemaps
  3. Submit your sitemap URL
  4. Check for any errors

Sitemap Best Practices

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.
Only update lastmod when content actually changes. Google may ignore sitemaps that update lastmod without real changes.
Don’t include:
  • Pages blocked by robots.txt
  • Pages with noindex meta tag
  • Redirect URLs
  • Login-required pages
Encode special characters in URLs:
  • & becomes &amp;
  • < becomes &lt;
  • > becomes &gt;
  • " becomes &quot;
  • ' becomes &apos;

Next Steps

SEO Optimization

Complete SEO checklist for your app