Semantic HTML 2.0: Why <details> and <summary> are AI Gold
Definition
The <details> and <summary> tags are a pair of native HTML5 elements that create a semantic "disclosure widget" (accordion), explicitly linking a summary label (the trigger) to a detailed description (the content) in the Document Object Model (DOM). Unlike JavaScript-based accordions which are semantically opaque "div soup," these tags provide AI agents with a hard-coded Question-Answer (Q&A) relationship, acting as a native signal for importance hierarchy and logical content grouping during vector ingestion.
The Problem: The "Accordion Trap" and Vector Drift
For the last decade, frontend developers have built accordions using JavaScript, React State, and nested <div>s.
The Typical "Div Soup" Accordion:
HTML
<div>
<div onClick={toggle}>How does pricing work?</div>
{isOpen && <div>Pricing is based on...</div>}
</div>
To a human, this looks fine. To an LLM or RAG (Retrieval-Augmented Generation) pipeline, this is a disaster for three reasons:
- Semantic Disconnect: There is no programmatic link between the header ("How does pricing work?") and the body ("Pricing is based on..."). They are just two <div> nodes that happen to be neighbors. If the chunking window cuts between them, the context is lost—a phenomenon we detailed in our Chunking Mismatch Guide.
- The "Hidden" State: If the content is hidden via display: none or not rendered in the DOM until a click event (common in React), non-rendering crawlers (like GPTBot) might miss it entirely.
- Token Bloat: JavaScript accordions require event listeners and CSS classes. This adds noise to the HTML, diluting the token density of the actual content.
The Consequence:
Your FAQ page, which should be the single best source of truth for an AI answering questions about your product, becomes a fragmented mess of disconnected text strings. The AI reads the question, but loses the answer.

The Solution: Native Q&A Modeling
The <details> element changes the game because it transforms "Layout" into "Logic."
When a crawler encounters this tag pair, it understands specific heuristics:
- Parent (<details>): This is the container of the concept.
- Key (<summary>): This is the high-level label, question, or entity name.
- Value (The Text): Everything else inside is the explanation, answer, or nuance.
The "Progressive Disclosure" Heuristic for RAG
Advanced RAG scrapers (like those used by Perplexity or SearchGPT) are beginning to use a "Summarization First" strategy.
- Step 1: Scan the <summary> tags to get a high-level map of the page's topics.
- Step 2: Decide which <details> block matches the user's intent.
- Step 3: Ingest only the content of that specific block.
This allows the AI to navigate your page like a database, retrieving specific answers with high precision rather than ingesting the whole page and guessing the context.
Technical Implementation: The Perfect FAQ Block
To maximize visibility, you should pair the semantic HTML with Schema.org structured data. This gives you a "Double-Tap" of clarity: one for the HTML parser, and one for the JSON-LD parser.
The HTML Structure
Do not add onclick events. Use the native open attribute if you want it expanded by default (though let the user control it).
HTML
<section>
<h2>Pricing Questions</h2>
<details name="pricing-group">
<summary>Does the Enterprise plan include API access?</summary>
<article>
<p>Yes, the Enterprise plan includes full GraphQL API access with a rate limit of 10,000 requests per minute.</p>
<table>
<tr><th>Plan</th><th>API Limit</th></tr>
<tr><td>Enterprise</td><td>10k/min</td></tr>
</table>
</article>
</details>
<details name="pricing-group">
<summary>What is the refund policy?</summary>
<p>We offer a 30-day money-back guarantee for all new subscriptions.</p>
</details>
</section>
Developer Note: Notice the use of the name attribute (new in Chrome 120+). This allows for "exclusive accordion" behavior (opening one closes others) natively, without a single line of JavaScript.
The Caveat Pattern (Brand Safety)
One of the best uses for <details> is to hide caveats, disclaimers, or complex terms that are necessary for truth but clutter the UI.
By placing legal disclaimers inside a <details> tag labeled "View Terms & Conditions," you ensure the text is accessible to the AI (protecting you from Brand Hallucinations regarding your policies) without ruining the visual user experience.
Comparison: JS Accordions vs. Semantic HTML
Feature | JS Accordion (<div>) | Semantic HTML (<details>) |
Semantics | Generic (No meaning) | Explicit (Parent/Child/Label) |
Crawler Visibility | Risk (Depends on rendering) | High (Text always available) |
Accessibility (a11y) | Requires ARIA attributes | Native (Keyboard/Screen Reader ready) |
JS Dependency | High (React/Vanilla JS) | Zero (Works without JS) |
RAG Utility | Low (Context often lost) | High (Logical Q&A pairs) |
Performance | Heavy (Script execution) | Instant (Browser native) |
The A11y / AI Overlap
It is crucial to note the intersection between Accessibility (a11y) and Artificial Intelligence.
Screen readers (for the blind) and AI Crawlers (for LLMs) function very similarly. They both traverse the DOM programmatically, relying on semantic tags to understand structure.
- If a screen reader knows that <summary> is a button that expands content, the AI knows it too.
- If your site is optimized for a11y (WCAG standards), it is almost always optimized for AEO (Answer Engine Optimization).
Using <details> is not just an SEO tactic; it is an inclusive design pattern that pays dividends in machine readability.
Code Example: Dual-Layer Optimization
Here is how to combine the Semantic HTML with the JSON-LD to ensure maximum ingestibility for your Entity Home FAQ section.
HTML
<details>
<summary>What is Website AI Score?</summary>
<p>Website AI Score is a diagnostic tool that measures how ingestible your website is for Large Language Models.</p>
</details>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [{
"@type": "Question",
"name": "What is Website AI Score?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Website AI Score is a diagnostic tool that measures how ingestible your website is for Large Language Models."
}
}]
}
</script>
Note: While this looks redundant, it is necessary redundancy. The HTML provides the context for the page vectors, while the JSON-LD provides the structured answer for the Knowledge Graph.
Key Takeaways
- Stop Using Divs for Logic: If an element opens and closes to reveal information, it must be a <details> tag. Stop using <div> for this.
- The Summary is the Hook: Treat the text inside <summary> as your H2. It should be keyword-rich and phrased as a question or clear label.
- Native = Fast: Native HTML elements render faster than React components. Speed correlates with crawl depth.
- Implicit Grouping: RAG parsers treat the content inside <details> as "Child Data" belonging to the <summary>. This protects your content from being taken out of context.
- Clean Code: The <details> tag allows you to delete hundreds of lines of JavaScript event listeners and CSS hackery. Less code = higher token density.
References & Further Reading
- MDN Web Docs: The Details disclosure element. Official documentation on the specs and accessibility features of the tag.
- W3C HTML5 Spec: Interactive Elements. The technical specification defining the summary/details relationship.
- Google Search Central: FAQ Structured Data. Guidelines on how to explicitly mark up questions and answers for rich results.

