
When an AI agent opens an article, it gets the HTML. The text is in there, between the menu, the footer, the cookie banner and the scripts. The agent has to guess where the article starts and where it ends.
My own sites already serve a Markdown copy of every article, each in its own way, because each site is built differently. I wrote markdown-copies to do the same thing for any site with one tool.
The problem
A page is made for a browser. An agent wants the text. Some services convert a page to Markdown when the request asks for it, but that gives the copy no address of its own. You cannot link to it, and an agent that does not know to ask never sees it.
An llms.txt at the root of the site is meant to help. Written by hand, it is out of date after the next article.
What markdown-copies does
It runs after the build, on the HTML the build wrote. For every page you include, it does four things.
It writes index.md next to index.html. The copy starts with a few lines of front matter: title, the page's canonical address, description, language, date, and the address of the same article in other languages. Then comes the text. Links and images are absolute. Navigation, footers, forms and buttons are left out.
It adds a link to the copy in the page's <head>, where programs look.
It adds a visible link at the end of the article, where people and agents that read the rendered page find it.
It builds llms.txt from the copies: one list per language, newest first. If you already have an llms.txt, your text stays at the top and the lists go under it.
A new article needs no extra work. It gets all four at the next build.
There is an Astro integration, three lines in the config. For any other site there is a command you point at the output folder.
What it leaves alone
The page is changed by two insertions. Everything else stays byte for byte, and the tests check that. A page marked noindex gets no copy, because a page you kept out of search engines should not get a second public address. A redirect page gets none, and neither does a duplicate whose canonical link names another page. A Markdown file you wrote yourself is never overwritten.
What I have tested
The tests build small sites in a temporary folder: two languages, pages with and without a trailing slash, odd HTML, a hand-written llms.txt. CI runs them on Linux and macOS with Node 20, 22 and 24.
I built a small Astro 7 site with the integration and read the output: the copies, the two insertions and the llms.txt. The examples in the README are from that build.
My own sites do not use this tool yet. They have the same result from code written for each site. Moving them is the next step, and I expect to find HTML this tool does not convert well.
What it does not do
Only pages that exist as files get a copy. Pages rendered on request do not. The conversion is as good as the HTML: text drawn by JavaScript is not in it.
Nobody has shown that a Markdown copy or an llms.txt makes a site rank better or get cited more. Google says its Search does not need them. The copies make the text easier to fetch and to link to. That is the whole claim.
Link text and headings are built in for English and Finnish. Other languages you set yourself.
Try it
The code is at github.com/ollijunes/markdown-copies. Run it with --dry-run first. It lists what it would write and changes nothing. Then read a few copies before you publish them.
Issues and pull requests are welcome, most of all pages that convert badly. Send the smallest HTML that shows the problem.
