# Title, Meta & Indexing

> The `<title>` element and a handful of `<meta>` tags are the primary way you communicate a page's purpose to search engines, browser tabs, and screen readers. Getting them right improves discoverability, accessibility, and click-through rates.

Subject: HTML | Lesson 37 of 42 | 6 min read
Interactive lesson: https://codewithanimation.in/html/title-meta-and-indexing
Previous: [Global Attributes & i18n](https://codewithanimation.in/html/global-attributes-and-i18n.md) | Next: [Social Previews & Structured Data](https://codewithanimation.in/html/social-and-structured-data.md)

## What the browser and search engines read

The `<title>` element in `<head>` is the most important piece of metadata on any page. It fills the browser tab label, the history and bookmark entry, the window title read by screen readers when the page loads, and the blue clickable headline in a search engine result. Search engines treat it as the primary signal for what the page is about. A descriptive, unique title matters both for indexing and for accessibility: WCAG 2.4.2 (Page Titled, Level AA) requires that every page have a title that describes its topic or purpose.

The `<meta name="description">` tag provides a short summary of the page. Search engines may display it as the grey snippet text under the title in results. It is not a ranking factor, but it directly affects click-through rate: a compelling description that matches what the user was searching for gets more clicks. Keep it under 160 characters and make it unique for each page. The `<link rel="canonical">` tag tells search engines which URL is the authoritative one when the same content is reachable at multiple addresses, preventing duplicate-content penalties.

## Why it matters beyond SEO

Screen readers announce the `<title>` when a page loads or when a user navigates to a new tab. For single-page applications that update the URL without a full reload, the title must be updated programmatically via `document.title = '...'` on each route change, otherwise every route sounds identical to AT users. This is one of the most common accessibility oversights in React and Next.js apps.

The `<meta name="robots">` tag controls crawler behaviour. `noindex` prevents a page from appearing in search results entirely (useful for admin pages, thank-you pages, and staging environments). `nofollow` tells crawlers not to follow the links on the page. `nosnippet` suppresses the description snippet. These are instructions to cooperating crawlers; they are not security controls.

## How to write effective titles and descriptions

For `<title>`, use the format `Page Name | Site Name` or `Site Name: Page Name`. Keep it between 50 and 60 characters so search engines do not truncate it. Make every page title unique. Avoid keyword stuffing; write for humans first.

For `<meta name="description">`, write one or two sentences (under 160 characters) that summarise what the user will find on the page. Include the main topic naturally -- not as a list of keywords. Each page should have a unique description that would make sense as a standalone summary.

Add `<link rel="canonical" href="https://example.com/page">` to every page pointing to its own canonical URL. This is especially important when the same content is accessible with and without a trailing slash, via both HTTP and HTTPS (if not redirecting), or via query strings that do not change the content.

## Common mistake: Reusing the same title and description on every page

The most common mistake is setting the `<title>` to the site name alone and using the same `<meta name="description">` on every page. To search engines, every page looks like a duplicate of the home page. To screen reader users, every page sounds identical when it loads. To browsers, every tab shows the same label. The fix is straightforward: generate the title and description dynamically from the page content, and make them unique. In Next.js, export a `metadata` object or `generateMetadata` function from each page module.

## Tip: meta name='keywords' has been ignored since 2009

Google announced in 2009 that the `<meta name="keywords">` tag has no effect on ranking. Other major search engines followed. It is still valid HTML but carries zero SEO value and may signal to spam filters that a page is using old black-hat tactics. Do not include it in new pages.

## Try it: Try it

Edit the title and description and watch the simulated search result snippet update in real time.

The animation is on the lesson page and is not part of this text version: https://codewithanimation.in/html/title-meta-and-indexing

## Check yourself

### Question 1

Which WCAG criterion requires every page to have a title that describes its topic or purpose?

- A. 2.4.2 Page Titled (Level AA)
- B. 1.1.1 Non-text Content (Level A)
- C. 3.2.4 Consistent Identification (Level AA)

Correct answer: A

WCAG 2.4.2 (Page Titled, Level AA) requires that web pages have titles that describe topic or purpose. The `<title>` element in `<head>` satisfies this criterion.

- Why not B: 1.1.1 covers text alternatives for non-text content like images. Page titles are covered by WCAG 2.4.2.
- Why not C: 3.2.4 covers consistent identification of components with the same functionality across a site. Page titles fall under 2.4.2.

### Question 2

Does the meta description tag directly improve a page's search ranking?

- A. No, but it affects click-through rate, which may indirectly influence ranking
- B. Yes, it is one of the primary on-page ranking signals
- C. No, search engines ignore it entirely

Correct answer: A

The meta description is not a ranking factor, but a well-written description that matches user intent gets more clicks, which can have indirect ranking effects. More importantly, it shapes the user's first impression of the page.

- Why not B: The meta description has not been a ranking signal for major search engines since at least 2009. It affects click-through rate, which can have indirect effects, but it does not directly determine position.
- Why not C: Search engines often use the meta description as the snippet text shown under the title in results. It does not affect ranking directly, but it affects the snippet and therefore click-through rate.

### Question 3

What does link rel='canonical' tell search engines?

- A. The preferred URL when the same content is reachable at multiple addresses
- B. The page should not be indexed
- C. The stylesheet to load for this page

Correct answer: A

`<link rel="canonical">` signals to crawlers which URL is the preferred version of a page. This prevents duplicate-content penalties when the same page is accessible at multiple URLs.

- Why not B: Preventing indexing is done with `<meta name="robots" content="noindex">`. Canonical tells search engines which URL is authoritative when there are duplicates.
- Why not C: Stylesheets use `<link rel="stylesheet" href="...">`. `rel="canonical"` is a hint about the authoritative URL for deduplication.

## Remember this

- `<title>` fills the tab, bookmark, screen reader announcement, and search headline. Make it unique and under 60 characters.
- `<meta name="description">` is not a ranking signal but shapes the search snippet. Keep it under 160 characters, unique per page.
- `<link rel="canonical">` prevents duplicate-content penalties. Add it to every page pointing to itself.
- `<meta name="keywords">` has no SEO value and should be omitted.
