Cloudflare HTMLRewriter Blueprint: Zero-Origin Schema.org @graph JSON-LD Injection
Updated 2026-11-01 · Grounded in 2459 audited B2B SaaS domains (average HTML payload: 239.7 KB) · All guides: /guides/
Marketing sites hosted on Webflow, Framer, HubSpot CMS, or locked frontend monorepos often cannot ship linked Organization + SoftwareApplication + FAQPage JSON-LD without weeks of sprint backlog. Stream-inject the exact @graph and RFC 8288 Link headers at the Cloudflare edge in under 1 millisecond:
const LINK_HDR = '</llms.txt>; rel="service-doc", </pricing.md>; rel="pricing", </.well-known/mcp.json>; rel="mcp"';
export default {
async fetch(req) {
const res = await fetch(req);
const ct = res.headers.get("content-type") || "";
if (!ct.includes("text/html")) return res;
const out = new HTMLRewriter()
.on("head", {
element(el) {
el.append(`<link rel="alternate" type="text/markdown" href="/llms-full.txt">`, { html: true });
el.append(`<script type="application/ld+json">${SCHEMA_GRAPH_JSON}</script>`, { html: true });
}
})
.transform(res);
out.headers.set("Link", LINK_HDR);
return out;
}
};