File conventions
Sitemap metadata route
Default export returns canonical public URLs; review freshness and XML. Source: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap
Formal Syntax & Structure
nextjs syntaxnextjs
app/sitemap.ts → MetadataRoute.SitemapWorking Example
Example Snippetnextjs
import type {MetadataRoute} from 'next';export default function sitemap():MetadataRoute.Sitemap { return ['river-walks','forest-notes'].map(slug=>({ url:`https://books.example/en/catalog/${slug}` }));}