# How to Serve Markdown to AI Agents (and Why)

DevFeed: [How to Serve Markdown to AI Agents (and Why)](<https://devfeed.tech/articles/how-to-serve-markdown-to-ai-agents-and-why-109250.md>)

Original publisher: [Read original article](<https://markodenic.com/serve-markdown-to-ai-agents/>)

Author: Marko

Published: 2026-10-30T14:20:43Z

Content type: tutorial

Language: en

Sources: [Marko Denic Blog](<https://devfeed.tech/sources/marko-denic-blog.md>)

Topics: [Markdown](<https://devfeed.tech/topics/markdown.md>), [AI Bots](<https://devfeed.tech/topics/ai-bots.md>), [cURL](<https://devfeed.tech/topics/curl.md>)

Tags: [2](<https://devfeed.tech/tags/2.md>), [2016](<https://devfeed.tech/tags/2016.md>), [2026](<https://devfeed.tech/tags/2026.md>), [22](<https://devfeed.tech/tags/22.md>), [3](<https://devfeed.tech/tags/3.md>), [agents](<https://devfeed.tech/tags/agents.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-agents](<https://devfeed.tech/tags/ai-agents.md>), [artificial-intelligence](<https://devfeed.tech/tags/artificial-intelligence.md>), [caching](<https://devfeed.tech/tags/caching.md>), [code](<https://devfeed.tech/tags/code.md>), [content](<https://devfeed.tech/tags/content.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [markdown](<https://devfeed.tech/tags/markdown.md>), [negotiation](<https://devfeed.tech/tags/negotiation.md>), [node](<https://devfeed.tech/tags/node.md>), [plus](<https://devfeed.tech/tags/plus.md>), [serve](<https://devfeed.tech/tags/serve.md>), [text](<https://devfeed.tech/tags/text.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>), [urls](<https://devfeed.tech/tags/urls.md>), [web-development](<https://devfeed.tech/tags/web-development.md>), [with](<https://devfeed.tech/tags/with.md>)

## AI overview

Serve each page's clean Markdown at a `.md` URL and negotiate Markdown on the normal URL when a request prefers `text/markdown`; browsers can continue receiving HTML. The article's Node example checks Accept quality values, serves Markdown only when a twin exists, and sets `Content-Type` with UTF-8, `Vary: Accept`, `Cache-Control: private`, and a canonical Link header. The main operational risk is shared caches that ignore `Vary`: they can store Markdown for a URL and show plain text to people, so the example prevents shared caching of Markdown and recommends checking agent and browser requests after deployment. Cloudflare offers an on-the-fly option for Pro, Business, or Enterprise plans, but it provides no `.md` URL and less control over the output. The article says Markdown is for agent readability, not SEO, and should carry the same content as HTML.

## Source excerpt

Serve clean Markdown to AI agents with .md URLs and Accept: text/markdown content negotiation. Tested Node code, plus the caching trap to avoid.