Documentation

Everything you need to add content negotiation to your Next.js app. Serve markdown to LLMs and HTML to humans — from the same URL.


How it works — the short version

HTTP has a built-in mechanism for content negotiation: the Accept header. When an LLM agent requests a page with Accept: text/markdown, next-md-negotiate intercepts the request and returns a markdown version instead of the normal HTML page.

The key insight: no new URLs are created. The same URL serves both formats. This means zero impact on your sitemap, zero duplicate content, and zero wasted crawling budget.

// Same URL, different Accept header, different response GET /products/42 Accept: text/html → HTML page (~26 KB) GET /products/42 Accept: text/markdown → Markdown doc (~101 B)