Use the Accept Header to Serve Markdown Instead of HTML to LLMs
6 hours ago
- #Cloudflare Workers
- #Markdown
- #SEO
- Serve Markdown instead of HTML to LLMs by checking the Accept header for text/plain or text/markdown before text/html.
- Static site generators like Astro can convert HTML to Markdown using tools like html-to-markdown-cli during the build process.
- Cloudflare Workers require specific configuration to serve Markdown based on Accept headers, involving wrangler.json and custom worker scripts.
- Traditional reverse proxies like Caddy can be configured more simply to serve Markdown or HTML based on the Accept header.
- Serving Markdown reduces token usage by 10x, making content more efficient for AI agents and potentially improving SEO and training data inclusion.