feat: Add Accept header content negotiation for markdown (#8272)

This commit is contained in:
Joseph
2026-01-28 21:48:01 +01:00
committed by GitHub
parent d340c41ba5
commit a2a19bae5f

View File

@@ -21,6 +21,20 @@ const nextConfig = {
},
async rewrites() {
return [
// Serve markdown when Accept header prefers text/markdown
// Useful for LLM agents - https://www.skeptrune.com/posts/use-the-accept-header-to-serve-markdown-instead-of-html-to-llms/
{
source: '/:path*',
has: [
{
type: 'header',
key: 'accept',
value: '(.*text/markdown.*)',
},
],
destination: '/api/md/:path*',
},
// Explicit .md extension also serves markdown
{
source: '/:path*.md',
destination: '/api/md/:path*',