Route Conflict Fixed ✅
Dev server was failing with error:
Error: You cannot define a route with the same specificity as a optional catch-all route
("/sitemap.xml" and "/sitemap.xml[[...__metadata_id__]]").
There were duplicate route handlers for sitemap and robots:
src/app/sitemap.ts(Next.js 14 metadata file) ✅ Modern approachsrc/app/sitemap.xml/route.ts(Old route handler) ❌ Conflictingsrc/app/robots.ts(Next.js 14 metadata file) ✅ Modern approachsrc/app/robots.txt/route.ts(Old route handler) ❌ Conflicting
Removed the old route handlers:
- ❌ Deleted
src/app/sitemap.xml/folder - ❌ Deleted
src/app/robots.txt/folder
Kept the modern Next.js 14 metadata files:
- ✅
src/app/sitemap.ts- Generates dynamic sitemap - ✅
src/app/robots.ts- Generates robots.txt
✅ Build successful: 58 pages generated
✅ Dev server working
✅ Routes properly configured
✅ No conflicts
/sitemap.xml- From sitemap.ts/robots.txt- From robots.ts
Both routes are now properly generated using Next.js 14 metadata API.