How to Serve Markdown to AI Agents from Hugo Sites on Cloudflare Pages Free Plan
AI agents and LLM crawlers prefer plain Markdown over HTML, but static hosting platforms like Cloudflare Pages cannot perform content negotiation based on request headers. A developer has outlined a two-part solution using Hugo and Cloudflare Pages that works entirely within the free tier. At build time, Hugo is configured to generate a companion .md file alongside every index.html using its output formats feature. At request time, a lightweight Cloudflare Pages Function reads the Accept header and serves the pre-built Markdown file when a client requests text/markdown, leaving browser requests unaffected. Because the Markdown is pre-rendered as a static file, the function does minimal processing and stays well within free-tier usage limits.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in