Sub topic 1
How search engines crawl, index, and show your page
Title tags, meta descriptions, and canonical URLs all influence search results. Each one acts at a different stage of the process that turns a URL into a search result. This chapter builds that model so the later chapters can say which element helps with which problem. The examples follow Google's behavior, and other engines work in broadly similar ways.
Prerequisites
This chapter assumes you know the following:
- Basic HTML structure, meaning the difference between
headandbody. - What a URL is, including the query string (the part after
?). - Common HTTP status codes such as 200, 301, 404, and 503.
- What a search engine results page looks like, with a blue title link, a URL, and a text snippet.
You don't need to have written any metadata before.
The pipeline at a glance
A search engine does not look up your page live when someone searches. It works ahead of time in stages, and each stage stores its output for the next one.
- Discovery. The engine learns that a URL exists. It finds URLs through links on pages it already knows, through sitemaps you submit, and through direct submission tools.
- Crawling. A program called a crawler (Googlebot, for Google) requests the URL over HTTP and downloads the response. Before it does, it checks the site's
robots.txtfile to see whether it is allowed to fetch that URL. - Rendering. If the page depends on JavaScript, the engine may run a headless browser to produce the final HTML. This often happens later than the first fetch.
- Indexing. The engine analyzes the content and decides whether to store the page. The index is a large database that maps words and signals to pages. During this stage the engine also groups duplicate pages and picks one URL to represent the group.
- Serving. When a user searches, the engine retrieves candidates from the index, ranks them, and builds the result display: the title link, the URL, and the snippet.
The stages matter because a directive only works at the stage where the engine reads it. If a crawler can't fetch a page, it never sees the tags inside it.
Where the three elements fit
All three elements live in the page's head (the next chapter covers the head in detail). Here is a minimal example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Trail Running Shoes for Beginners | Example Store</title>
<meta name="description" content="Compare cushioned trail running shoes for first-time runners, with fit tips and a size guide.">
<link rel="canonical" href="https://www.example.com/shoes/trail-running">
</head>
<body>
<h1>Trail Running Shoes for Beginners</h1>
</body>
</html>The table maps each element to the stage where it has its main effect.
| Element | Main stage | What it does |
|---|---|---|
| `<title>` | Indexing and serving | Describes the page for ranking and usually becomes the title link in results. |
| `<meta name="description">` | Serving | Offers text the engine may use as the snippet. It is not a ranking signal. |
| `<link rel="canonical">` | Indexing | Suggests which URL should represent a group of duplicate pages. |
Notice the wording: "usually," "may," and "suggests." None of these elements is a command. The engine reads them as input and makes its own decision, which is why later chapters spend time on cases where the engine disagrees with you.
Crawling in more detail
A crawler has a limited budget of requests for each site, often called crawl budget. Small sites rarely hit that limit. Large sites with many URL variants can, because every variant is a separate URL the crawler may spend a request on.
The crawler records the HTTP status code for each fetch, and the code changes what happens next:
- 200 means the content is eligible for indexing.
- 301 and 302 mean the crawler follows the redirect to the target URL. A 301 is a strong signal that the target is the preferred URL.
- 404 and 410 mean the page is missing, and the engine eventually drops it from the index.
- 5xx means a server error. The crawler retries later and slows its crawl rate. Long-lasting errors can cause pages to be dropped.
You can inspect what a crawler sees by requesting the page yourself:
curl -sI https://www.example.com/shoes/trail-runningThe -I flag fetches only the response headers. Check the status line, any Location header, and any Link or X-Robots-Tag headers. Those headers can carry the same directives as head tags.
robots.txt controls crawling, not indexing
This is the most common misunderstanding at this stage. A robots.txt rule such as Disallow: /private/ tells compliant crawlers not to fetch those URLs. It does not tell the engine to leave them out of the index. If other sites link to a blocked URL, the engine can still index the bare URL, usually with no description, because it never read the page.
Indexing in more detail
After fetching and rendering, the engine decides what to store. Several things can happen here:
- The page is indexed as is.
- The page is skipped because of a
noindexdirective, an error, or low perceived quality. - The page is recognized as a duplicate or near duplicate of another URL and grouped with it.
Grouping is where canonical URLs matter. One page can be reachable at many addresses: with and without www, over http and https, with tracking parameters, with a trailing slash, or with filter and sort parameters. The engine clusters these variants and picks one as the canonical, the URL that appears in results. The others are called duplicates. They are usually crawled less often and don't appear separately.
Your rel="canonical" link is one of several signals the engine weighs when choosing. Redirects, internal links, sitemap entries, and the protocol used all count too. If your signals disagree, the engine may pick a different URL than the one you declared. Chapter on conflicting signals covers this in depth.
Serving: how the result is built
Serving happens each time someone searches. The engine retrieves matching pages from the index and ranks them. For each result it then builds a display from stored data, and this is where the title and description show up.
- Title link. The engine usually builds it from your
<title>element. It can use other sources, such as the mainh1heading, if the title looks missing, repetitive, or unrelated to the content. - URL line. The engine shows the canonical URL it selected, usually in a shortened, breadcrumb-like form.
- Snippet. The engine builds it at query time. It may use your meta description if that describes the page well for the query. Otherwise it pulls a passage from the page body that matches the searcher's words.
Because the snippet is built per query, one page can show different snippets for different searches. This is expected behavior and not a bug in your markup.
What this model predicts
Once you know the stages, many symptoms become easy to explain.
| Symptom | Likely stage | Reason |
|---|---|---|
| Result shows a URL with no description | Crawling | `robots.txt` blocked the fetch, so the engine never read the page. |
| Result shows a parameter URL instead of the clean one | Indexing | The engine chose a different canonical than you declared. |
| Result shows a title you didn't write | Serving | The engine rewrote the title link for that result. |
| Description differs from your meta tag | Serving | The engine found body text that matched the query better. |
| New page not in results | Discovery or crawling | The page is not linked or not in a sitemap, or it hasn't been fetched yet. |
Summary of the model
Discovery finds the URL, crawling fetches it if robots.txt allows, indexing stores it and chooses a canonical among duplicates, and serving builds the title link and snippet for each query. The title, description, and canonical are inputs the engine may follow or override at the stage where it uses them.
Exercise
A page has <meta name="robots" content="noindex"> in its head, and the site's robots.txt also contains Disallow: for that page's path. The page still appears in search results as a bare URL. Which stage explains this, and what should you change?
Show answer
The crawling stage explains it. The robots.txt rule stops the crawler from fetching the page, so it never reads the noindex tag. Other pages linking to the URL can still cause it to be indexed without content. Remove the Disallow rule so the crawler can fetch the page and see the noindex directive. The URL then drops out of the index after the next crawl.
Exercise
Your meta description says "Free shipping on all trail shoes," but a search result for your page shows a sentence from the middle of the article instead. Is something wrong with your markup?
Show answer
Not necessarily. The snippet is built at query time. The engine may replace the meta description with body text that matches the searcher's words better. Check that the description is accurate and describes the page, but expect different snippets for different queries.