Sub topic 9
Letting crawlers fetch and read the page
A comparison page can have strong criteria, clear evidence and a tidy table, and still never appear in an AI answer. If the system's crawler cannot fetch the page, or fetches it and finds no content, the page is not a candidate. This chapter covers the access layer: who may fetch the page, what they receive, and how to check both.
This chapter assumes you know basic HTML, how search engines crawl and index pages, and how to read JSON. It follows the chapters on page structure and retrieval, and it feeds the chapter on measurement.
Fetching and reading are two separate steps
Access fails in two places. Keep them apart when you debug.
- Fetch. The crawler requests the URL. Robots rules, firewalls, login walls, status codes and timeouts decide whether it gets a response.
- Read. The crawler receives a response and extracts text from it. The HTML, any scripts it runs, and the page's size decide whether your table and ranked list are in what it extracts.
A page can pass step 1 and fail step 2. A typical case is a 200 response that contains only an empty <div id="app"> and a script bundle.
Robots rules per user agent
The robots.txt file sits at the root of your host, for example https://example.com/robots.txt. It groups rules by user agent, the name a crawler uses to identify itself. A crawler follows the most specific group that matches its name. If none matches, it follows the * group.
Different AI systems use different crawlers for different jobs. Vendors commonly separate at least three purposes:
- Training crawlers collect content to train models.
- Search crawlers build an index that an assistant searches when it answers.
- User-triggered fetchers retrieve a page because a person's request pointed at it.
This matters because you can make different choices for each purpose. A site might block training crawlers and allow search crawlers. A page that is blocked for the search crawler cannot be retrieved from that system's index.
# robots.txt: allow a search-oriented AI crawler and a general crawler
User-agent: OAI-SearchBot
Allow: /
User-agent: PerplexityBot
Allow: /
User-agent: *
Allow: /User-agent names change and vendors add new ones. Confirm the current names and what each one does in the vendor's own documentation before you edit rules. Do not copy lists from blog posts without checking them.
Common robots mistakes
- A blanket
Disallow: /left over from staging. It often ships to production by accident. Check the live file after each deploy. - Blocking a path that your comparison pages live under, such as
/blog/or/tools/, while allowing the rest. - Blocking CSS and JavaScript directories. Some crawlers render pages, and they need those files.
- Treating robots.txt as access control. It is a request that well-behaved crawlers honor. It does not hide a page, and a disallowed URL can still be known from links elsewhere.
- Expecting a robots change to take effect immediately. Crawlers cache the file, so changes can take hours or days.
Blocks that robots.txt does not show
Many fetch failures come from infrastructure, not from the robots file. Your robots.txt can say "allow" while your firewall says "no".
| Layer | What it can do | How to notice |
|---|---|---|
| CDN or web application firewall | Challenges or blocks unfamiliar bots, or traffic from data-center IP ranges | 403 or 429 responses to bot user agents; a challenge page instead of your content |
| Rate limiting | Returns 429 when a crawler makes many requests | 429 entries in server logs for bot traffic |
| Login or consent wall | Shows a gate before the content | The fetched HTML is the gate, not the page |
| Geo or cookie rules | Serves different content by region or requires a cookie | Different responses from different locations |
| Meta robots and `X-Robots-Tag` | Tells crawlers not to index or show snippets | A `noindex` or `nosnippet` directive in headers or HTML |
Two of these are easy to miss. First, a noindex directive on a page you want cited works against you, so look for it in both the HTML and the HTTP headers. Second, snippet controls such as nosnippet or max-snippet limit how much text a search system may use. Setting them for your whole site, for example from an SEO plugin default, can reduce what a system is allowed to quote.
If you use a bot-protection service, check whether it has a setting for verified AI search crawlers. Allowing them there is separate from editing robots.txt. Where a vendor publishes IP ranges or a verification method, use those to allow its crawler. Do not rely on the user-agent string alone, because anyone can fake it.
Content that exists only after JavaScript runs
A browser runs your scripts and builds the page. A crawler may not. Some crawlers execute JavaScript, some do so only for part of their traffic, and some never do. You usually cannot tell which one is visiting. The safe approach is to make sure the content that matters is in the first HTML response.
Content at risk includes:
- The comparison table, when it is built from a JSON feed by client-side code.
- Prices and ratings loaded after page load.
- Ranked list items inside tabs, accordions or "load more" buttons.
- Text injected by a personalization or A/B testing script.
Server-side rendering (SSR) or static generation puts the content into the HTML before it leaves the server. Both work well for comparison pages, which change slowly and do not need per-visitor logic.
The test is simple: compare what the server sends with what a browser shows. Fetch the raw HTML and search it for text that must be present.
import sys
import urllib.request
url = sys.argv[1]
must_contain = sys.argv[2:] # strings such as "Tool A" "$8" "Free plan"
request = urllib.request.Request(
url, headers={"User-Agent": "raw-html-check/1.0"}
)
with urllib.request.urlopen(request, timeout=15) as response:
status = response.status
body = response.read().decode("utf-8", errors="replace")
print(f"status: {status}, bytes: {len(body)}")
for text in must_contain:
found = text in body
print(f"{'ok ' if found else 'MISSING'} {text!r}")
if not found:
sys.exit(1)Run it as python check_raw.py https://example.com/best-project-tools "Tool A" "$8". A MISSING line for something visible in your browser means the content depends on JavaScript. This script does not run scripts, which is the point: it shows roughly what a non-rendering crawler gets. It also does not imitate a bot's user agent or IP, so it cannot detect firewall rules that target bots.
Make the content easy to extract
Once the HTML arrives, extraction works better when the markup is plain.
- Use a real
<table>with<caption>,<th scope="col">and<th scope="row">, as in the earlier structure chapter. Do not build tables out of nested<div>elements or put them in images. - Keep key facts as text. A screenshot of a pricing grid is invisible to a text-based crawler.
- Put the ranked list in headings and paragraphs that stay visible without interaction. If you use accordions, make sure the collapsed text is still in the HTML.
- Keep the page reasonably sized. Some systems truncate long documents, so put the summary table and top picks high on the page rather than after thousands of words.
- Give each product a stable anchor, such as
#tool-a, so the same URLs you list in your ItemList markup resolve to a section. - Return a clean canonical URL. If the same page is reachable with many tracking parameters, set a
rel="canonical"link so signals do not split across copies.
Status codes and redirects
Crawlers read status codes literally.
| Status | Meaning for a crawler | Action |
|---|---|---|
| 200 | Content available | The goal for every comparison page |
| 301 / 308 | Permanent move | Use for changed URLs; keep chains short |
| 302 / 307 | Temporary move | Avoid for pages that have moved for good |
| 403 | Forbidden | Usually a firewall or permission rule; check bot settings |
| 404 / 410 | Missing or gone | Fix, or redirect to the replacement page |
| 429 | Too many requests | Relax rate limits for verified crawlers |
| 5xx | Server error | Fix; repeated errors reduce how often crawlers return |
A "soft 404" is a page that returns 200 but shows an error message or an almost empty template. Crawlers may treat it as low value. Avoid it when you retire a product: redirect to a relevant page or return a proper 404 or 410.
Check access with your own logs
Your server or CDN logs are the best evidence of who really visits. Filter requests by user agent for the crawlers you care about, and record the status code each one received.
import re
import sys
from collections import Counter
# Matches the user agent and status in a common "combined" log line.
LINE = re.compile(r'"\S+ (?P<path>\S+) [^"]*" (?P<status>\d{3}) .*"(?P<ua>[^"]*)"$')
BOTS = ("OAI-SearchBot", "PerplexityBot") # confirm names in vendor docs
counts = Counter()
for line in open(sys.argv[1], encoding="utf-8", errors="replace"):
match = LINE.search(line.strip())
if not match:
continue
for bot in BOTS:
if bot in match["ua"]:
counts[(bot, match["status"])] += 1
for (bot, status), n in sorted(counts.items()):
print(f"{bot:15} {status} {n}")Read the output this way. Mostly 200s means the crawler is getting through. A cluster of 403 or 429 points to your firewall or rate limits. No rows at all can mean the crawler has not visited yet, or that the bot is blocked before reaching your origin server, so also check CDN logs. Because user-agent strings can be spoofed, treat counts as an estimate unless you verify IP ranges.
A short access checklist
- Fetch
/robots.txton the live host and confirm no rule blocks the page for the crawlers you want. - Request the page with a plain HTTP client and confirm a 200 status.
- Search the raw HTML for the table, the product names and the prices.
- Check headers and meta tags for
noindexand snippet restrictions. - Review CDN and firewall settings for bot challenges and rate limits.
- Check server logs for crawler requests and the status codes they got.
- Repeat after every deploy, since robots files, headers and rendering often change by accident.
Exercise
Your comparison page shows a full table in a browser. The robots.txt allows the AI search crawler. Your raw-HTML check script reports that "Tool A" and "$8" are MISSING, but logs show the crawler gets 200 responses. What is the likely cause, and what are two fixes?
Show answer
The table is built by client-side JavaScript after load, so the first HTML response does not contain it. The crawler fetches the page successfully (the 200) but cannot read the table. Fixes: render the table on the server or generate it statically so the text is in the initial HTML, or output the table as plain HTML in the template and use JavaScript only to enhance it, such as sorting.
Exercise
A page returns 200 to your browser, but your logs show repeated 403 responses to a search crawler's user agent, even though robots.txt allows it. Where do you look first, and why can't a robots.txt edit fix it?
Show answer
Look at the CDN or web application firewall and bot-protection settings. robots.txt only states crawl rules for crawlers that read it. A 403 is returned by infrastructure that blocks or challenges the request before or regardless of those rules. Allow the verified crawler in the firewall, preferably by the vendor's published IP ranges or verification method rather than by user-agent string alone.