Skip to content
Every tutorial here is 100% free — and always will be
How-Tointermediate6 min readCurrent · checked 24 Aug 2026

How to Generate a Dynamic Sitemap

Serve an XML sitemap that updates itself as you publish new content, instead of a static file that goes stale.

Published 24 Aug 2026 · Tested with Lovable as of 24 Aug 2026

Overview

A dynamic sitemap is generated from your database each time it is requested, so new content appears automatically.

Beginner explanation: A static sitemap is a list you have to remember to update. A dynamic one updates itself.

Technical explanation: Serve the sitemap from a server route that queries published content and returns XML with the correct content type, plus last-modified dates.

Steps

  1. List which content types belong in the sitemap.
  2. Add a server route that returns XML.
  3. Include only published, indexable URLs.
  4. Add last-modified dates from your content records.
  5. Reference the sitemap in robots.txt and submit it.

:::tip Exclude search result pages, drafts and duplicate paths. A clean small sitemap beats a large messy one. :::

What to check afterwards

  • The sitemap URL returns valid XML
  • Only live URLs are listed
  • New content appears without a redeploy

Common problems

  • Wrong content type header. Some crawlers reject it.
  • Draft URLs included.
  • Sitemap not referenced in robots.txt.

Where people get stuck

If you have followed the steps and the result still is not right, the fastest path is usually to describe the exact behaviour you expected, the behaviour you got, and any error text, then ask for a fix in one focused follow-up prompt. If that loop is not converging, hand it over.

Prompts that pair with this guide

Related guides

Website made, maintained and hosted by PromptSites.com

PromptSites logo