Sub topic 16
Diagnosing why a page is not crawled or indexed
This chapter assumes you know the pipeline from earlier chapters: discovery, robots.txt, fetching, rendering, canonicalization, and the inverted index. It also assumes you can read short Python snippets. Here you will combine those pieces into a repeatable checklist.
Two different questions
"My page isn't in search" is really two problems.
- Not crawled: the crawler never fetched the URL, or the fetch failed.
- Crawled but not indexed: the crawler fetched the page, but the indexer chose not to store it, or stored it under a different URL.
Separating these tells you where to look. Server logs, robots.txt, and status codes explain crawl problems. Directives, canonicals, rendered content, and duplicates explain indexing problems.
Check the causes in order
Each stage depends on the one before it. A page that was never discovered cannot be blocked by a noindex tag, so checking later stages first wastes time. Work through the stages in pipeline order and stop at the first failure.
1. Discovery
A crawler needs a way to learn the URL. Check three things:
- Does at least one crawlable page link to it with a plain
<a href>? Links created only by a click handler, or that appear only inside a form submission, are often invisible to link extraction. - Is it listed in an XML sitemap that the crawler has fetched? A sitemap is a hint, not a command.
- Is the page an orphan, with no internal links? Orphans can be discovered through sitemaps, but they get little priority in the frontier.
Also look at normalization. If your internal links use /page?session=abc or mixed-case paths, the crawler may be tracking variants of the URL you did not intend.
2. robots.txt
Test the exact URL against the exact user agent. Rules match by path prefix, and a more specific group for one crawler replaces the * group for that crawler. A rule like Disallow: /search also blocks /search-tips.
Two edge cases matter:
- Fetching robots.txt can itself fail. Many crawlers treat a 5xx response on robots.txt as "don't crawl anything for now". A server error on that one file can pause crawling of the whole site.
- Blocked is not the same as unindexed. A URL blocked by robots.txt can still appear in results as a bare URL if other pages link to it. The crawler never read the page, so it cannot see a
noindextag there. To remove a page, let it be crawled and servenoindex.
3. Fetch status
Look at what the server actually returns to the crawler, not what your browser shows. Logged-in sessions, cookies, and your IP address can all hide problems.
| Observation | Likely meaning | Action |
|---|---|---|
| 200 with the expected content | Fetch is fine | Move to step 4 |
| 301 or 302 to another URL | The crawler follows it and indexes the target, not the original | Link to the final URL |
| Long redirect chains or loops | The crawler gives up after a few hops | Redirect directly to the final URL |
| 404 or 410 | The page is gone and will be dropped | Restore it, or accept removal |
| 403 or 401 | The server refuses the crawler | Check firewall, bot protection, and login walls |
| 429 or 5xx | The server is overloaded or rate limiting | Fix capacity. The crawler will slow down |
| Timeouts | Slow responses reduce crawl rate | Improve response time |
| 200 with "not found" text | A soft 404, which is often treated as a 404 | Return a real 404 status |
Repeated errors and slow responses make a crawler lower its rate, which delays discovery of every other page on the host too.
4. Rendered content
If the page is a JavaScript app, the raw HTML may be nearly empty. Rendering often happens later than fetching, so a page can be indexed quickly without its client-side content. Compare the raw response against the rendered DOM. If a key phrase appears only after scripts run, you depend on the renderer. A script that fails, a blocked JavaScript file, or an API call disallowed by robots.txt can all leave the page looking blank to the indexer.
5. Indexing directives and canonicals
Look for these:
- A
<meta name="robots" content="noindex">tag in the HTML. - An
X-Robots-Tag: noindexHTTP header. This is easy to miss, and it is the only way to apply noindex to PDFs and other non-HTML files. - A
<link rel="canonical">that points to another URL. The page you are checking may be a duplicate that was folded into the canonical.
6. Quality, duplicates, and freshness
If everything above passes, the engine may have chosen not to index the page. Common reasons are near-duplicate content, thin content, or low priority in the crawl budget. A new page on a large site may also simply be waiting for its next scheduled visit.
A script that runs the checks
The script below performs checks 2, 3, 4, and 5 for one URL. It does not follow redirects, so you see the first response, like a crawler would before deciding to follow. It reads at most 500,000 bytes of the body.
import sys
import urllib.error
import urllib.request
from html.parser import HTMLParser
from urllib.parse import urljoin, urlparse
from urllib.robotparser import RobotFileParser
class NoRedirect(urllib.request.HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
return None
class HeadParser(HTMLParser):
def __init__(self):
super().__init__()
self.robots = []
self.canonical = None
def handle_starttag(self, tag, attrs):
a = dict(attrs)
if tag == "meta" and (a.get("name") or "").lower() == "robots":
self.robots.append((a.get("content") or "").lower())
elif tag == "link" and "canonical" in (a.get("rel") or "").lower().split():
self.canonical = a.get("href")
def fetch(url, agent):
opener = urllib.request.build_opener(NoRedirect)
req = urllib.request.Request(url, headers={"User-Agent": agent})
try:
resp = opener.open(req, timeout=10)
status = resp.status
except urllib.error.HTTPError as err:
resp = err
status = err.code
body = resp.read(500000).decode("utf-8", errors="replace")
headers = resp.headers
resp.close()
return status, headers, body
def diagnose(url, agent="ExampleBot", phrase=None):
parts = urlparse(url)
rp = RobotFileParser(f"{parts.scheme}://{parts.netloc}/robots.txt")
rp.read()
print("robots.txt allows:", rp.can_fetch(agent, url))
status, headers, body = fetch(url, agent)
print("status:", status)
if 300 <= status < 400:
print("redirects to:", urljoin(url, headers.get("Location", "")))
return
print("X-Robots-Tag:", headers.get("X-Robots-Tag"))
parser = HeadParser()
parser.feed(body)
print("meta robots:", parser.robots or None)
canonical = urljoin(url, parser.canonical) if parser.canonical else None
print("canonical:", canonical, "(matches)" if canonical == url else "(differs or missing)")
if phrase:
print("phrase in raw HTML:", phrase.lower() in body.lower())
if __name__ == "__main__":
diagnose(sys.argv[1], phrase=sys.argv[2] if len(sys.argv) > 2 else None)Run it as python diagnose.py https://example.com/guide "key phrase". If the phrase is missing from the raw HTML but visible in your browser, the content depends on JavaScript rendering.
Reading symptoms backwards
Tools such as search console reports use status labels. Map them back to the pipeline:
| Reported state | Stage that failed |
|---|---|
| Discovered, not yet crawled | Frontier priority or crawl budget |
| Blocked by robots.txt | Permission check |
| Crawled, not indexed | Indexer decision: quality, duplicate, or directive |
| Duplicate, alternate page with canonical | Canonicalization |
| Excluded by noindex | Indexing control |
| Soft 404 | Fetch status versus page content |
"Discovered, not yet crawled" is the one most often misread. The crawler knows the URL but has not scheduled it. More sitemap entries will not help. Better internal links, faster responses, and fewer low-value URLs on the site will.
After the fix
A fix does not take effect until the crawler returns. After correcting the cause, make sure the page is reachable and linked, update lastmod in the sitemap if the content changed, and request a recrawl if your tools allow it. Then check server logs for a fetch by the crawler's user agent. The log tells you whether the fix has been seen yet, which a search for the page cannot.
Exercise
A page returns 200 and has no noindex tag, but it does not appear in search. Its robots.txt group contains "Disallow: /reports/". The page URL is /reports/2026.html. Another site links to it. What is the most likely state of the page in the index, and what should you change if you want it fully removed?
Show answer
The URL is blocked from crawling, but because another site links to it, it may still appear as a bare URL without a description. To remove it, remove the Disallow rule so the crawler can fetch the page, serve a noindex meta tag or X-Robots-Tag header, wait for the recrawl, and only then consider blocking again.
Exercise
Put these checks in the order you should run them: noindex tag, 404 status, robots.txt rule, sitemap listing, canonical pointing elsewhere.
Show answer
Sitemap listing (discovery), robots.txt rule (permission), 404 status (fetch), noindex tag, canonical pointing elsewhere. The last two are indexing decisions, and either order is acceptable between them.