Adding Markdown for Agents to an Astro page
I recently ran the Is Your Site Agent-Ready? test by Cloudflare which checks different standards on a website to find out whether agents (like Claude Code or OpenClaw) will be able to work with it. One of the criteria is whether the website offers Markdown (blog post by Cloudflare). The easiest way for this is to use the “Markdown for Agents” feature on the Pro plan of Cloudflare Workers, but it’s actually quite easy to implement for many websites with Cloudflare Workers for free.
All the code is in the repo for my website szymonnastaly.com.
By default, websites are returned as HTML pages which can be rendered by browsers. Using content negotiation a client can tell a webserver to send out the response in a different format. In my case, I implemented a server side capability to send out markdown if the client (which will be an agent) requests it. The downside is that this is not possible with a static site (for example one that you host on GitHub Pages) — you need a webserver to check which format the client requested, for example HTML or Markdown, and to respond with the correct version.
My website uses Astro and the content is stored as Markdown files in a Content Collection. This makes the implementation relatively simple:
During the build process, one sets Astro to save both the HTML page, but also a .md version. All of those files are stored in one /dist directory.
A Cloudflare Worker (this is a webserver which has a generous free tier) runs in front of those assets, looks at the format requested for pages by the client and responds with the correct type (either HTML or Markdown).
That’s it! I recommend you to check your website in the https://isitagentready.com/ check, maybe you can also improve your page.