Agent Ready HTML

Keep the answer in main, not in header or footer

In short

Cloudflare, Firecrawl and Jina Reader strip navigation and footers before converting a page, and Mozilla Readability drops nodes whose class or id names contain words such as footer, sidebar or menu. Cloudflare's Markdown for Agents strips headers too, so answer text belongs inside the main element, which the HTML standard defines as the dominant contents of the document.

Published 22 November 2026

The HTML standard defines the main element as the dominant contents of the document, and a document must not have more than one main element that does not have the hidden attribute specified. In the standard's own example, main wraps the main content of the page, as opposed to the header, the footer, the navigation bar and a sidebar. MDN's main reference adds that browser reader mode looks for main, as well as heading and content sectioning elements, when it converts content into a reader view.

What header and footer hold, and what Cloudflare removes

Per the sections chapter, header represents a group of introductory or navigational aids and can also wrap a section's table of contents, a search form or logos. A footer typically contains who wrote its section, links to related documents and copyright data. The same chapter allows marking the main content with article when it is all one single self-contained composition, though it calls that technically redundant.

Cloudflare's Markdown for Agents documentation states that non-content elements, such as headers, footers, navigation, scripts and styles, are stripped during pre-processing, and it refers to Workers AI Markdown Conversion for the full list of removed elements. That HTML pre-processing ignores script and style tags. The cssSelector option takes a string with a CSS selector pattern to pick specific elements from the HTML, and the page refers readers to how HTML is processed for more details.

Related: How to serve markdown on request on each host

Boilerplate filters and selectors in Firecrawl and Jina Reader

With onlyMainContent set to true, which is the default, Firecrawl's scraping guide says boilerplate (nav, footer, etc.) is stripped. Its includeTags and excludeTags parameters take CSS selectors and are applied against the original page DOM, not the post-filtered result, so selectors should target elements as they appear in the source HTML. Setting onlyMainContent to false makes the full page the starting point for tag filtering.

Jina says its Reader strips boilerplate such as navigation, headers, footers and ads, then converts the main content to Markdown. X-Target-Selector extracts only content matching the CSS selectors you give it (the page's example is article, .main-content, #post-body). X-Remove-Selector works the other way and removes elements before extraction, with nav, footer, .sidebar, #ads as its example.

Class names, roles and hidden nodes in Readability

The Readability README describes the library as a standalone version of the readability library used for Firefox Reader View. For each node, the Readability.js source builds a match string from the class name and id, then removes the node as an unlikely candidate when that string matches the unlikelyCandidates pattern and does not also match okMaybeItsACandidate. Banner, breadcrumbs, comment, footer, header, menu, related, sidebar, social, sponsor and popup all appear in unlikelyCandidates. That check skips any node with a table or code ancestor, and it never applies to the body element or to a elements.

UNLIKELY_ROLES holds menu, menubar, complementary, navigation, alert, alertdialog and dialog. Earlier in the same loop, Readability removes nodes that are probably not visible, nodes that carry both aria-modal="true" and role="dialog", and a header that duplicates the article title.

The Readability.js source has a negative pattern whose terms include hidden, banner, comment, contact, footer, masthead, promo, related, share, sidebar, sponsor, tags and widget, and a positive pattern whose terms include article, body, content, entry, main, page, post, text, blog and story.

Mark up the page so the answer survives

  1. Wrap the answer in one main element. MDN says the content of a main element should be unique to the document. Content repeated across a set of documents, such as sidebars, navigation links, copyright information, site logos and search forms, shouldn't be included unless the search form is the main function of the page.
  2. Put site chrome in real nav, aside and footer elements. In the ARIA landmarks pattern, the HTML main element automatically creates a main landmark region and the nav element creates a navigation landmark region. The pattern names as a best practice that all content is contained within an appropriate landmark region, and gives seven or fewer landmark regions on a page as a general rule of thumb.
  3. Keep the intro, key dates and summary out of header and footer elements. Place that text in the main body content instead.
  4. Keep boilerplate names and roles off the answer's container. Avoid class and id values from Readability's unlikelyCandidates and negative patterns, and roles from UNLIKELY_ROLES, on the element that holds the answer.
  5. Set the title and description meta tags. Cloudflare builds the front matter title from <meta name="title">, with fallback to og:title, and the description from <meta name="description">, with fallback to og:description.

Test the page with one extractor

To run Readability on a saved copy, create a Readability object from a DOM document and call parse(). In Node.js the README uses jsdom; pass the page's URI as the url option so Readability can convert relative URLs to absolute ones. Because parse() works by modifying the DOM, hand it a clone of the document. Then search textContent, the article text with all the HTML tags removed, for the sentence you need. By default an article must have 500 characters (charThreshold) for a result to come back.

Related: Check your initial HTML like an agent does

Jina's Reader API fetches the URL server-side and returns LLM-ready text; compare that output with the same sentence.

Related: Plain Fetch viewer

Sources

  1. WHATWG: HTML Standard: Grouping content (the main element) https://html.spec.whatwg.org/multipage/grouping-content.html, read 22 November 2026
  2. WHATWG: HTML Standard: Sections https://html.spec.whatwg.org/multipage/sections.html, read 22 November 2026
  3. MDN: <main>: The Main element https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/main, read 22 November 2026
  4. W3C WAI: Landmarks Pattern (ARIA Authoring Practices Guide) https://www.w3.org/WAI/ARIA/apg/patterns/landmarks/, read 22 November 2026
  5. Cloudflare: Markdown for Agents https://developers.cloudflare.com/fundamentals/reference/markdown-for-agents/, read 22 November 2026
  6. Cloudflare: Markdown Conversion: How it works https://developers.cloudflare.com/workers-ai/features/markdown-conversion/how-it-works/, read 22 November 2026
  7. Cloudflare: Markdown Conversion: Conversion Options https://developers.cloudflare.com/workers-ai/features/markdown-conversion/conversion-options/, read 22 November 2026
  8. mozilla/readability README https://github.com/mozilla/readability, read 22 November 2026
  9. Mozilla: Readability.js (source) https://raw.githubusercontent.com/mozilla/readability/main/Readability.js, read 22 November 2026
  10. Firecrawl: Advanced Scraping Guide https://docs.firecrawl.dev/advanced-scraping-guide, read 22 November 2026
  11. Jina AI: Reader API https://jina.ai/reader/, read 22 November 2026

Last reviewed 22 November 2026