Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 1.12 KB

File metadata and controls

36 lines (29 loc) · 1.12 KB

Route Conflict Fixed ✅

Issue

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__]]").

Root Cause

There were duplicate route handlers for sitemap and robots:

  • src/app/sitemap.ts (Next.js 14 metadata file) ✅ Modern approach
  • src/app/sitemap.xml/route.ts (Old route handler) ❌ Conflicting
  • src/app/robots.ts (Next.js 14 metadata file) ✅ Modern approach
  • src/app/robots.txt/route.ts (Old route handler) ❌ Conflicting

Solution

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

Result

✅ Build successful: 58 pages generated
✅ Dev server working
✅ Routes properly configured
✅ No conflicts

Routes Generated

  • /sitemap.xml - From sitemap.ts
  • /robots.txt - From robots.ts

Both routes are now properly generated using Next.js 14 metadata API.