Sub topic 4
Headings that match the questions people ask
This chapter assumes you know basic HTML heading levels and have written or edited web content such as docs, blog posts, or help articles. It also assumes you have read the chapters on passage retrieval and answer-first structure. Here you will learn how to write headings that match the questions people actually ask, and how to avoid the common ways headings fail.
Why headings matter to retrieval
A heading is the label for the passage beneath it. Many retrieval pipelines split a page at its headings, and some attach the heading text to each chunk. This varies by system, and vendors do not publish exact details. Treat the following as a working model, not a guarantee.
When a system decides whether a passage fits a user's question, the heading is often the shortest, clearest signal of what the passage covers. A heading such as "How long should I cache API responses?" tells both a reader and a retrieval system what the passage answers. A heading such as "Overview" tells them nothing.
Headings do three jobs:
- They label the chunk, so the passage can be matched to a query.
- They give a reader scanning the page a way to find the answer.
- They show where one self-contained passage ends and the next begins.
Question-led headings
A question-led heading is a heading phrased as the question a reader would ask. The passage under it then answers that question in its first one or two sentences, as the answer-first chapter described.
Compare these pairs:
| Vague heading | Question-led heading |
|---|---|
| Caching | How long should I cache API responses? |
| Canonical URLs | What is a canonical URL? |
| Setup | How do I install the command-line tool? |
| Limits | What is the maximum file size for uploads? |
| Billing | Why was I charged twice this month? |
The right-hand headings are specific. Each states the topic, the kind of answer expected (a number, a definition, a procedure, a cause), and often the reader's own words.
Where to find the real questions
Do not invent questions from your own point of view. Collect the phrasing your audience uses. Useful sources:
- Your support tickets, chat logs, and community forum threads.
- The search queries that already bring visitors to your site, from your analytics or search console.
- The "People also ask" boxes and related searches that a search engine shows for your topic.
- Questions you can ask an AI assistant about your topic, which show how it phrases and expands the question.
- Sales and onboarding calls, where people ask in plain, unpolished language.
Keep the reader's vocabulary. If customers say "cancel my subscription", a heading that says "Terminating your service agreement" will match their question poorly.
Descriptive headings when a question does not fit
Not every heading should be a question. A question heading suits a passage that answers one question. Other content needs a different shape.
- A procedure is better labeled "How to rotate an API key" than "How do I rotate an API key?" Both work. Pick one style and apply it consistently within a page.
- A reference table is better labeled "Rate limits by plan" than a forced question such as "What are the rate limits by plan?"
- A comparison is better labeled "Postgres vs. MySQL for small teams".
- A conceptual section can use a noun phrase that names the concept, such as "Idempotency keys".
The test is whether the heading describes the specific content below it. A descriptive heading that names the subject and the kind of content is fine. A heading made only of a generic word is not.
Heading hierarchy
Headings form an outline. Use one h1 for the page title, h2 for main sections, and h3 for subsections that belong to an h2. Do not skip levels (an h2 followed directly by an h4), and do not pick a level for its visual size. Use CSS for appearance.
A clean outline helps in two ways. Screen readers and browsers use it for navigation. Chunking code that follows the hierarchy can keep a subsection with its parent, so the context of an h3 is not lost.
Here is the canonical URL example from the plan, annotated for its outline:
<section id="what-is-a-canonical-url">
<h2>What is a canonical URL?</h2>
<p>A canonical URL is the preferred address of a page when the same content is reachable at several URLs. You declare it with a <code><link rel="canonical"></code> element in the page head, so search engines know which version to index.</p>
<h3>How to choose the canonical version</h3>
<ol>
<li>Pick the URL you want people to land on.</li>
<li>Use the full absolute URL, including the protocol.</li>
<li>Add the same canonical link to every duplicate page.</li>
</ol>
</section>The h2 is a question and the first paragraph is a definition that answers it. The h3 narrows to a procedure under that topic. Each part has one job.
Checking your headings with a script
You can audit a page for the most mechanical problems: skipped levels, duplicate headings, and generic one-word headings. The script below uses only the Python standard library. It reads an HTML file and reports these problems.
import sys
from html.parser import HTMLParser
GENERIC = {"overview", "introduction", "details", "more", "info",
"information", "misc", "other", "general", "notes", "setup"}
class HeadingCollector(HTMLParser):
def __init__(self):
super().__init__()
self.headings = [] # list of (level, text)
self._level = None
self._buffer = []
def handle_starttag(self, tag, attrs):
if len(tag) == 2 and tag[0] == "h" and tag[1] in "123456":
self._level = int(tag[1])
self._buffer = []
def handle_data(self, data):
if self._level is not None:
self._buffer.append(data)
def handle_endtag(self, tag):
if self._level is not None and tag == f"h{self._level}":
text = " ".join("".join(self._buffer).split())
self.headings.append((self._level, text))
self._level = None
def audit(html):
parser = HeadingCollector()
parser.feed(html)
problems = []
seen = {}
previous = 0
for level, text in parser.headings:
if previous and level > previous + 1:
problems.append(f"Skipped level before h{level}: '{text}'")
if text.lower().strip("?.: ") in GENERIC:
problems.append(f"Generic heading: '{text}'")
key = text.lower()
if key in seen:
problems.append(f"Duplicate heading: '{text}'")
seen[key] = True
previous = level
return parser.headings, problems
if __name__ == "__main__":
path = sys.argv[1]
with open(path, encoding="utf-8") as f:
headings, problems = audit(f.read())
for level, text in headings:
print(" " * (level - 1) + f"h{level} {text}")
print()
print("Problems:" if problems else "No problems found.")
for p in problems:
print("-", p)Run it with python audit_headings.py page.html. It prints the outline with indentation, then lists problems. It cannot tell whether a heading matches a real question. That judgment stays with you.
Common errors
Clever or branded headings
A heading like "Cache me if you can" is memorable to a human and says nothing to a retrieval system. Put the plain topic in the heading. Keep wordplay for the body, if at all.
Headings that need the page title to make sense
A heading such as "Pricing" under a page about one product is clear in context. Lifted out of the page, it is not. A chunk may be shown or scored without the title. Write "Pricing for the Team plan" when the passage must stand alone. The next chapter covers this in more detail.
Questions the passage does not answer
A heading that promises an answer and then opens with background breaks the contract. If the heading asks "How long should I cache API responses?", the first sentence must give a duration or a rule for choosing one.
One heading, several questions
A section titled "Installing, configuring, and troubleshooting" covers three questions in one chunk. Split it into three headings, each with its own answer-first passage.
Keyword stuffing
Do not repeat a target phrase in every heading. Repeated near-identical headings such as "Best CRM software", "Best CRM software for teams", and "Best CRM software 2026" create overlapping chunks and read as spam to people. Write each heading for one distinct question.
Too many question headings
A page where every heading is a question reads like a script. Use questions where a real question exists and descriptive headings elsewhere.
Limits of this technique
Headings raise the chance that a passage is matched to a query. They do not make a system select or cite your page. Systems differ in how they chunk, rank, and attribute sources, and those details change. Question-led headings also help ordinary readers and traditional search, so the effort pays off even if a particular AI system ignores them.
Summary of the working rules
- Use the reader's wording, taken from real questions.
- Use a question when the passage answers one question, and a specific descriptive phrase otherwise.
- Answer the heading's question in the first sentence or two beneath it.
- Keep one topic per heading and a clean, unskipped hierarchy.
- Make each heading understandable without the page title.
- Keep headings visible and honest.
Exercise
A page about a billing feature has these headings: "Overview", "Cache me if you can" (a section on how long invoices stay available for download), and "Setup, limits, and errors". Rewrite them as three or more better headings, and say which rule each rewrite follows.
Show answer
Possible rewrites: (1) "Overview" becomes "What is invoice history?" because a generic heading should name the topic and kind of content, ideally as the question a reader would ask. (2) "Cache me if you can" becomes "How long can I download past invoices?" because a branded or clever heading should be replaced with plain wording that states the question the passage answers. (3) "Setup, limits, and errors" is split into "How do I turn on invoice history?", "What is the maximum number of invoices I can download at once?", and "Why does my invoice download fail?" because one heading should cover one question, each with its own answer-first passage. Any equivalent rewrites that use the reader's wording and give one topic per heading are acceptable.
Exercise
You run the heading audit script on a page and it reports "Skipped level before h4: 'Retry limits'". What is wrong, and how do you fix it? Also name one problem the script cannot detect.
Show answer
An h4 follows an h2 (or the previous heading is more than one level above it), so the outline jumps a level. Fix it by changing "Retry limits" to h3 if it belongs under the preceding h2, or by adding the missing h3 parent if one is genuinely needed. The script cannot detect whether a heading matches a question your audience really asks, or whether the passage beneath it answers the heading in its first sentence.