Sub topic 7
Meta description and search snippets
This chapter assumes you know basic HTML syntax, the structure of a document (doctype, html, head, body), and that a search engine crawls pages and shows results. Here you will learn what the meta description is, how search engines use it, and how to write one that works.
What the meta description is
The meta description is a meta element in the head. Its name is description, and its content is a short summary of the page.
<meta name="description" content="Compare lightweight trail running shoes by grip, cushioning, and weight.">The visitor never sees this text on the page. Search engines read it, and they may show it under your title in a result. That block of text under the title is called a snippet.
How search engines use it
A search engine builds each snippet for the query it is answering. It can use your description, or it can pull text from the visible page. Google, for one, says it uses the meta description when it describes the page better than the page text does for that query.
This gives you the first rule: the meta description is a suggestion, not a command. It does not guarantee what appears in a result. It is also not a ranking tool. Treat it as copy that persuades a person to click.
Writing a good description
Write one description per page. Keep these points in mind:
- Describe what this page offers, in plain sentences. Do not repeat the title word for word.
- Aim for roughly 120 to 160 characters. Results are cut off by pixel width, not by a fixed count, so long text may end in an ellipsis.
- Put the most useful words first. A truncated snippet should still make sense.
- Make it unique. The same description on every page tells searchers nothing about any one page.
- Do not stuff keywords. It reads badly and does not help.
Compare two descriptions for the same page:
| Weak | Better |
|---|---|
| Shoes, running shoes, trail shoes, buy shoes, cheap shoes | Compare lightweight trail running shoes by grip, cushioning, and weight. |
| Welcome to our website | See how 12 trail shoes rate on grip, cushioning, and weight, with prices. |
The weak versions list keywords or say nothing. The better versions say what the visitor will find.
Placement and syntax
Put the tag inside head, with the other meta tags. Its position relative to other tags is not critical, but the character encoding still has to come first. A later chapter covers head ordering.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Trail Running Shoes - Example Store</title>
<meta name="description" content="Compare lightweight trail running shoes by grip, cushioning, and weight.">
</head>
<body>
<h1>Trail Running Shoes</h1>
</body>
</html>Use only one description tag per page. If a page has several, the search engine has to choose, and you lose control over which one it picks.
Common errors
- Unescaped quotes. A straight double quote inside the
contentvalue ends the attribute early. Use"or rephrase.
``html <meta name="description" content="Our "Ridge" shoe has a 6 mm drop."> ``
- Empty or missing content. An empty description gives the engine nothing to use. Leave the tag out, or write a real one.
- Duplicates across pages. Templates often copy one description to every page. Generate it from each page's own data.
- Expecting a fixed result. If a search result shows different text than you wrote, the engine chose other text for that query. That is normal behavior, not a bug in your HTML.
Other tools may read the description too. Some link-preview systems fall back to it when no Open Graph description exists, which a later chapter covers.
Check your work
Open the page, then open developer tools and look at the Elements panel. Find the meta tag with name="description" in the head and confirm the text is what you wrote. A validator will also flag a duplicate or malformed tag.
Exercise
A page has <meta name="description" content="Our "best" boots">. What is wrong, and how do you fix it? Also, if a search engine shows different text than your description, is that an error in your HTML?
Show answer
The straight double quotes around "best" end the content attribute early, so the description is cut to "Our ". Fix it by escaping them as "best" or by removing the inner quotes. Showing different text is not an HTML error. The meta description is a suggestion, and the engine may build a snippet from the page text when that matches the query better.