What Is Content Negotiation and Why Does It Matter for AI Search?
How to serve HTML and Markdown from the same URL, make content accessible to AI agents and preserve SEO. An experiment on rui-martins.com.
One of the things I've been exploring on my personal website (rui-martins.com) is how we make information available to AI agents.
Does it make sense to deliver content to an AI agent in exactly the same format as we deliver it to someone visiting our website?
This is what led me to experiment with content negotiation, an HTTP mechanism that has been around for decades but is becoming relevant in a different context.
What is content negotiation?
Content negotiation allows a server to deliver different representations of the same resource based on the preferences of the requesting client. For my website, I'm particularly interested in delivering HTML or Markdown from the same URL.
People can continue browsing the website as usual, while an AI agent explicitly requesting Markdown can receive a simpler representation of the same content.
rui-martins.com/en/
Accept: text/htmlHTMLBrowser / standard requestAccept: text/markdownMarkdownCompatible AI clientHTML pages typically contain navigation, scripts and other components that are important to the browsing experience but may be less relevant to an agent looking for information to answer a question. If we can deliver that information more efficiently and reduce the number of tokens required to process it, I think it's worth experimenting.
How does it work?
HTTP allows clients to express their preferred content format through the Accept header. For example:
Accept: text/htmlAccept: text/markdown
The server can then return the corresponding representation, identifying the format through the Content-Type response header. It's also important to configure Vary: Accept correctly, particularly to prevent caching systems from serving the wrong representation. Section 12 of RFC 9110 describes this mechanism.
What I've implemented on my website
For those following my Build in Public project, I'm developing the website using ChatGPT/Codex, GitHub and Cloudflare.
I've kept HTML as the primary format and created alternative Markdown representations of my pages, automatically generated during each build, in both Portuguese and English.
I've also:
- Enabled Cloudflare Search for Agents;
- Made the Markdown resources accessible to crawlers;
- Implemented discovery through HTTP Link headers;
- Retained HTML URLs in the XML sitemap;
- Configured standalone Markdown URLs with noindex directives and canonical references to the original pages.
As for content negotiation itself, I've decided to start with just the Portuguese and English homepages, keeping HTML as the default response format. Shared caching is disabled during this pilot. The noindex directive on the standalone Markdown URLs must not carry over to the canonical URL.
I've also chosen not to implement llms.txt at this stage. I'm interested in understanding what we can achieve with established web mechanisms before introducing additional conventions.
Want to try it?
You can test the implementation on my website using these two commands.
HTML:
curl -i -H "Accept: text/html" https://rui-martins.com/en/Markdown:
curl -i -H "Accept: text/markdown" https://rui-martins.com/en/Compare the Content-Type and Vary headers and the returned content. You can also access the standalone Markdown homepage.
Providing a Markdown file and implementing content negotiation are two different things. With content negotiation, the agent doesn't need to know the alternative Markdown URL in advance.
If you're using Cloudflare, its Markdown for Agents feature is also worth exploring. It converts HTML to Markdown for compatible requests. Search for Agents is a separate feature that searches indexed website content.
If you want to replicate the experiment, I'd start with a small number of pages: keep the content equivalent, test the headers and caching, verify that HTML remains indexable, and then consider extending it.
What does this mean for SEO and AI Search?
This is where I have more questions, and where I think we need to be careful about the conclusions we draw.
Making information easier to access is one thing. Having that information selected by an AI model to answer a question or recommend a company is another.
We don't yet have sufficient evidence to conclude that delivering Markdown through content negotiation improves rankings or increases the likelihood of being recommended. Google's own guide to generative search optimisation explains that special content formats are not required to appear in its generative search experiences.
That's why I'm continuing to work on traditional SEO, content architecture, internal linking and the quality of the information itself. I also discuss these foundations in my article on Generative Engine Optimization (GEO).
What will I be measuring over the next few months?
I want to understand which agents use these representations, what content they look for, how much we can reduce the volume of information being processed, and whether there is any change in citations and recommendations.
More importantly, I want to understand the impact on business generation.
I'm already tracking successful contact form submissions server-side through Cloudflare, without cookies, and I'll also be assessing the quality of those enquiries. Attribution won't always be possible, of course. An increase in enquiries following a technical change does not, by itself, establish causation.
Can SEO and AI Search, working together, compensate for a potential decline in organic traffic by generating more qualified enquiries? That's what I want to find out.
I'll continue documenting these experiments, including those that don't produce the results I'm hoping for. If you're running similar experiments on your own website, I'd be very interested to hear what you're finding.
You can follow the project in my Build in Public journal.
Some useful references
- HTTP Semantics — RFC 9110
- MDN — Content Negotiation
- Cloudflare — Markdown for Agents
- Cloudflare — Search for Agents
- Google — AI optimization guide
Frequently asked questions
Is Markdown required to appear in ChatGPT?
There is insufficient evidence to consider it a universal requirement.
Does content negotiation improve Google rankings?
No direct ranking benefit has been established. It is a delivery mechanism, not a proven ranking factor.
Do I need Cloudflare?
No. Content negotiation is part of HTTP and can be implemented on other infrastructure.
Do I also need an llms.txt file?
It may be worth experimenting with, but it is not a requirement for content negotiation.