Agent Content Negotiation
Making agent-friendly pages with content negotiation

Making agent-friendly pages with content negotiation

2/3/2026

What this post added

Introduced content negotiation for agent-friendly pages by implementing `Accept` header handling in Next.js. This involves rewrite rules in `next.config.ts` to route `text/markdown` requests to dedicated route handlers (`app/blog/md/[...slug]/route.ts`) that convert CMS rich text to markdown. Also added markdown sitemap generation (`app/blog/sitemap.md/route.ts`, `app/docs/sitemap.md/route.ts`) for agent discovery and described the use of `link rel="alternate"` tags.

Read the original post ↗