Sub topic 9
Sitemaps, structured data and clean HTML still do the heavy lifting
This chapter assumes you know how a web server returns HTML over HTTP, can read basic Markdown, and have met robots.txt and llms.txt in earlier chapters. It compares the older web standards with the newer AI-specific proposals. The older ones are established, widely consumed, and measurable, so they usually deserve your effort first.
Why the older standards matter more
Crawlers, search engines and AI assistants all start from the same raw material: the HTML your server returns. A proposal like llms.txt asks a consumer to fetch one extra file and trust it. Sitemaps, structured data and well-formed HTML have a different footing. Major search engines document how they use them, and many tools parse them.
Retrieval systems that power AI search often build on a conventional search index or on their own crawl of ordinary pages. If a page is not discovered, cannot be parsed, or is ambiguous, no extra file will fix that. Treat the AI-specific files as an optional layer on top of a sound foundation.
The table below summarises what each mechanism does and who is known to read it.
| Mechanism | What it expresses | Who consumes it | Evidence of use |
|---|---|---|---|
| XML sitemap | Which URLs exist, and when they changed | Search engine crawlers, many other bots | Documented by major search engines |
| Structured data (schema.org) | What a page is about, in machine-readable terms | Search engines, some other parsers | Documented for rich results and entity understanding |
| Semantic, clean HTML | Document structure: headings, lists, tables, main content | Every crawler and text extractor | Universal, because all of them parse HTML |
| llms.txt | A curated reading list for language models | Unclear. Some tools and users | Limited and hard to verify |
The last row is not a verdict on llms.txt. It shows that evidence of adoption differs between the rows, and you should weigh effort accordingly.
Sitemaps
A sitemap is an XML file that lists the URLs you want crawled, with optional metadata. The format is defined at sitemaps.org. It solves a discovery problem: a crawler that follows links may miss deep, new or poorly linked pages. A sitemap hands it the list directly.
A minimal sitemap looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/docs/quickstart</loc>
<lastmod>2026-11-01</lastmod>
</url>
<url>
<loc>https://example.com/docs/api</loc>
<lastmod>2026-11-20</lastmod>
</url>
</urlset>Points that cause trouble in practice:
- Accuracy of lastmod. Set
lastmodonly when the page content really changed. If every URL always shows today's date, crawlers learn to ignore the field. - Size limits. A single sitemap file may hold up to 50,000 URLs and 50 MB uncompressed. Larger sites use a sitemap index file that points to several sitemaps.
- Canonical URLs only. List the canonical form of each URL. Do not list redirects, pages blocked by robots.txt, or pages marked
noindex. Mixed signals waste crawl budget and can confuse indexing. - Discovery. Add a
Sitemap:line to robots.txt, as in the earlier robots.txt example, so any crawler can find it without guessing.
A sitemap differs from llms.txt in an important way. A sitemap is exhaustive and machine-oriented, with no descriptions. llms.txt is curated and human-readable, with a short summary of each link. They answer different questions: "what exists" versus "what matters most".
Structured data
Structured data is extra markup that states facts about a page in a fixed vocabulary. The most common vocabulary is schema.org, usually written as JSON-LD (JSON for Linked Data) inside a script element.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "TechArticle",
"headline": "Quickstart for the Example library",
"datePublished": "2026-10-12",
"dateModified": "2026-11-01",
"author": { "@type": "Organization", "name": "Example Inc." }
}
</script>Structured data helps a consumer answer questions that plain text leaves open: is this an article, a product, a FAQ, an event? Who wrote it? When was it last changed? Search engines use it for rich results. Whether a given AI assistant uses it is rarely documented, so avoid promising that it will change AI citations.
Common errors:
- Markup that disagrees with the visible page. Search engine guidelines treat markup for content users cannot see as a violation. Mark up only what appears on the page.
- Invalid syntax. A missing comma silently breaks the whole block. Validate with the Schema.org validator or a search engine's testing tool.
- Over-marking. Adding every possible type does not help. Pick the types that describe the page honestly.
Clean, semantic HTML
Most crawlers that feed AI systems extract text from HTML. How well they do depends on how your page is built. Clean HTML makes the main content easy to find and keeps navigation, ads and scripts from polluting it.
Practical rules:
- Put the content in the initial HTML response. Many crawlers do not run JavaScript, or run it only with limits. If your article text appears only after a client-side script fetches it, a simple crawler sees an empty shell.
- Use real headings in order. One
h1, thenh2andh3nested logically. Headings give extractors a table of contents and a way to split a page into passages. - Use semantic elements.
main,article,nav,headerandfootertell a parser which part is the content. - Use real lists and tables. A table built from
tableelements keeps its rows and columns when extracted. A table drawn with images ordivgrids may lose them. - Write descriptive link text and alt text. "Read the API reference" carries meaning when extracted alone. "Click here" does not.
- Return correct status codes. A "soft 404", where a missing page returns 200 with an error message, pollutes indexes. Return 404 or 410 for missing pages and 301 for permanent moves.
You can test what a non-JavaScript crawler sees with a short script:
import urllib.request
from html.parser import HTMLParser
class TextExtractor(HTMLParser):
def __init__(self):
super().__init__()
self.skip = 0
self.parts = []
def handle_starttag(self, tag, attrs):
if tag in ("script", "style"):
self.skip += 1
def handle_endtag(self, tag):
if tag in ("script", "style") and self.skip:
self.skip -= 1
def handle_data(self, data):
if not self.skip and data.strip():
self.parts.append(data.strip())
url = "https://example.com/"
req = urllib.request.Request(url, headers={"User-Agent": "text-check/1.0"})
html = urllib.request.urlopen(req).read().decode("utf-8", errors="replace")
parser = TextExtractor()
parser.feed(html)
text = " ".join(parser.parts)
print(len(text), "characters of visible text")
print(text[:300])If the printed length is near zero for a page that looks full in a browser, your content depends on JavaScript. That is a more serious problem for AI visibility than a missing llms.txt.
How these pieces fit together
The diagram shows that llms.txt, where a consumer uses it at all, joins the pipeline at the discovery step. Everything after that depends on the HTML you serve.
A sensible order of work
Because these standards have different levels of evidence, a practical order is:
- Make sure important pages return full content in the initial HTML with correct status codes.
- Publish an accurate sitemap and reference it from robots.txt.
- Add structured data where a matching type exists and the data is visible on the page.
- Decide your robots.txt policy for AI crawlers, as covered earlier.
- Optionally add llms.txt and Markdown variants, then check your logs to see whether anyone fetches them.
Step 5 is cheap, but it comes last because it has the weakest evidence of benefit.
Quick self-check
Before moving on, audit one real page of your own. Fetch it without JavaScript, confirm the main text is present, confirm its URL appears in the sitemap with an honest lastmod, and validate its structured data. A page that passes these four checks is in good shape whatever happens to the newer proposals.
Exercise
A documentation site renders every article with a JavaScript framework that fills an empty div after the page loads. The site has a well-written llms.txt linking to all articles. Why might AI crawlers still see little content, and what is the first fix?
Show answer
Many crawlers do not execute JavaScript, so they receive the empty initial HTML and find no article text. llms.txt only tells them which URLs to visit, not how to read them. The first fix is to serve the article text in the initial HTML response, using server-side rendering or static generation, or to link to Markdown versions of the pages. Then confirm with a no-JavaScript fetch that the text is present.
Exercise
Name two ways a sitemap can work against you, and give the correction for each.
Show answer
First, listing URLs that are blocked by robots.txt or marked noindex sends mixed signals. Correct it by listing only canonical, indexable URLs. Second, setting lastmod to the current date on every URL makes crawlers distrust the field. Correct it by updating lastmod only when the page content actually changes.