Sub topic 3
The title tag
This chapter assumes you know basic HTML structure (head and body), how URLs and query strings work, and what a search results page looks like. It covers what the <title> element is, where search engines use it, and the errors that cause trouble in practice.
What the title tag does
The <title> element sits inside <head>. A page may have only one. It gives the page a name, and three consumers read it:
- Browsers show it in the tab and in the history list.
- Search engines use it as a strong clue about the page's topic. They also use it as the main source for the clickable headline in search results.
- Other tools use it as the default name for bookmarks and shared links.
The title is not the same as the <h1>. The <h1> is the visible heading for people who are already on the page. The title is the label people see before they arrive, so it must make sense with no surrounding context.
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 title names the topic first and the site second, and it matches what the page contains. The <h1> is close to the title but not identical, which is fine.
Where the title fits in the pipeline
A crawler fetches the HTML and the indexer reads the <title> along with the body. When your page matches a query, the search engine builds a result listing, and the title is the main input for its headline.
Common errors
| Problem | What happens | Fix |
|---|---|---|
| Missing `<title>` | The engine invents a headline from headings or link text. | Add a descriptive title. |
| Same title on many pages | Pages look alike in results and compete with each other. | Write a unique title per page. |
| Very long title | The display is cut off, often around 50 to 60 characters or about 600 pixels. | Put key words first. |
| Keyword stuffing | The title reads as spam and may be replaced. | Write one natural phrase. |
| Generic text such as "Home" | The title says nothing about the content. | Name the topic and the brand. |
| Title set only by JavaScript | The crawler may see an empty or default title. | Put the title in the served HTML. |
The length limits are not fixed. Search engines truncate by pixel width, not by character count, so wide letters use up space faster. Treat 60 characters as a rough guide, not a rule.
Quick checks
You can read the title of any page from the command line:
curl -s https://www.example.com/shoes/trail-running | grep -i -o '<title>[^<]*</title>'This shows the title in the served HTML, which is what a crawler sees before it runs any JavaScript.
Exercise
Exercise
A site gives every product page the title "Welcome to Example Store". Name two problems this causes and one fix.
Show answer
Every page looks identical in search results, so users cannot tell them apart and the pages compete with each other. The title also says nothing about the content, which weakens the topic signal. Fix it by generating a unique title per page from the product data, for example "Trail Runner X200 Shoes | Example Store".