mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
## Summary This fixes adapter `onBuildComplete` outputs for dynamic metadata routes. ## Bug `handleBuildComplete` skipped metadata routes too aggressively via `isStaticMetadataFile(...)`, so dynamic metadata routes (for example `robots.txt` / `sitemap.xml` using `connection()`) were omitted from `outputs.appRoutes`. ## Fix Only skip metadata routes when they are actually prerendered/static (present in prerender manifests). Dynamic metadata routes are now included in adapter `outputs.appRoutes` as expected. ## Tests Added e2e coverage in `test/e2e/app-dir/adapter-dynamic-metadata`: - verifies dynamic `robots.txt`, `sitemap.xml`, and `favicon.ico` functionality - verifies adapter output classification for non-deploy runs - skips output-shape verification in deploy mode - skips the suite in dev mode
13 lines
244 B
TypeScript
13 lines
244 B
TypeScript
import type { MetadataRoute } from 'next'
|
|
import { connection } from 'next/server'
|
|
|
|
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
|
await connection()
|
|
|
|
return [
|
|
{
|
|
url: 'https://example.com',
|
|
},
|
|
]
|
|
}
|