This recipe serves a markdown representation of your HTML pages through HTTP content negotiation.

Markdown is a lightweight markup language for creating formatted text. Compared to HTML, it is easier to read, and it drastically reduces the amount of markup relative to the textual content.

With this recipe enabled, when a client sends an Accept: text/markdown request header, redirection.io converts the HTML response body to markdown on the fly and returns it with a Content-Type: text/markdown response header. Clients that do not request markdown keep receiving the original HTML. No separate markdown files are created, and the URL does not change.

Why serve markdown?

LLM-based agents, AI crawlers, and developer tools increasingly consume markdown rather than HTML. Markdown strips navigation, scripts, and layout markup, which lowers token count and gives models cleaner input. Serving it through content negotiation lets you expose a markdown version of every page without maintaining a parallel set of .md files, without duplicating URLs, and without changes to your application or build pipeline.

How this recipe works

Once installed, the recipe enables two rules on the path you configured:

  • Vary on the Accept header: this rule adds a Vary: Accept response header to all the pages under the configured path. Since the same URL can now return either HTML or markdown depending on the request, this header tells browsers, CDNs, and other shared caches to store the two variants separately, so that a client expecting HTML is never served a cached markdown response, or the reverse.
  • Convert HTML to markdown: when the request Accept header is text/markdown, this rule converts the HTML response to markdown and sets the Content-Type response header to text/markdown.

The conversion runs in the redirection.io agent, at request time, on the response your origin already returns. The quality of the output depends on the structure of the source HTML: well-structured, semantic HTML produces cleaner markdown.

Points to consider

  • Accept header matching: the conversion rule triggers whenever text/markdown appears anywhere in the Accept header, regardless of its position or quality value. This is intentional: standard browsers never send text/markdown, so any client listing it is, in practice, asking for it. If you want a stricter behavior, edit the rule and change the condition to starts with or equals.
  • Caching in front of redirection.io: the Vary: Accept header is only effective if the caches between your users and the redirection.io agent honor it. Most CDNs do, but check your CDN configuration if you use custom cache keys.
  • Scope: apply the recipe to the parts of your website where markdown output makes sense, typically content pages such as blog posts or documentation. Application screens, forms, and pages that depend heavily on JavaScript will not convert well.

How to install this recipe on my website with redirection.io?


  1. 1. Configuration

  2. 2. Installation

  3. 3. Validation

Installing this recipe on your website requires the following steps:

In order to install this recipe, you need to:

  1. Configure the path to convert to markdown on-demand: define the part of your website for which markdown should be served on request. It must start with a /. To enable the conversion for your entire website, use the / path. To restrict it to a section, use a more specific path, such as /blog/ or /docs/.
  2. Click on "Install on My Website": click the "Install on My Website" button. This will create the two associated redirection.io rules in "draft" mode.
  3. Review the created rules: one rule adds the Vary: Accept response header on the configured path, the other performs the HTML to markdown conversion when the request Accept header contains text/markdown. Edit them if necessary.
  4. Publish on your website: publish the rules to activate the conversion. You can then test it with curl -H "Accept: text/markdown" https://www.example.com/blog/some-article.

Discover our recipes to improve your website's quality in one click

redirection.io's recipes are a powerful feature designed to simplify the implementation of front-end quality best practices for your websites. Think of them as a curated "app store" for your site, offering a variety of pre-configured solutions that can be installed with a single click.

Discover all redirection.io recipes