Sub topic 7
Meta description and search snippets
This chapter assumes you can write basic HTML, know the parts of a document (doctype, html, head, body), and have a general idea of what a search engine does with a page. You will learn what the meta description is, what search engines do with 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 in plain text.
<meta name="description" content="Compare lightweight trail running shoes by grip, cushioning, and weight.">The HTML standard defines this element. Each document may have at most one meta element with name="description". The content attribute must be present and holds the summary. The element is not shown on the page. Browsers ignore it when they render the page. Its readers are search engines, link-sharing tools, and other programs that read the head.
What a search snippet is
A search result has three visible parts: a title link, a URL, and a few lines of descriptive text. The descriptive text is the snippet. Your title element usually supplies the title link. The meta description is one possible source of the snippet.
The word "possible" matters. The meta description is a suggestion, not an instruction. A search engine builds each snippet at the time of the search. It can use your description, or it can pull text from the page body that matches the searcher's words better.
The diagram below shows the decision a search engine makes.
Because the choice depends on the query, one page can show different snippets for different searches. That is normal behavior. It is not a bug in your markup.
What a meta description does and does not guarantee
Treat these as the working rules.
- It does not guarantee the snippet. The search engine may replace it with body text.
- It does not directly raise your ranking. Google has said it does not use the meta description as a ranking signal. A good description can still help you indirectly, because a clear snippet can persuade more people to click.
- It does not control the exact length shown. Search engines truncate snippets based on the width of the display, not on a fixed character count.
- It is not private. Anyone can view the source and read it.
- It does not stop indexing. Use the robots meta tag for that, which a later chapter covers.
Writing a useful description
Write the description for a person who is deciding whether to click. Describe what the page offers in the same words the searcher is likely to use.
Practical guidelines:
- Write one or two complete sentences that summarize this page, not the whole site.
- Make it unique. Every page needs its own description. Copying one description across a whole site gives search engines no useful information.
- Put the key point first. Long descriptions get cut off, and the cut usually removes the end.
- Aim for roughly 120 to 160 characters as a starting range. This is a rule of thumb, not a standard. Desktop and mobile displays truncate at different points.
- Match the page content. A description that promises something the page does not deliver leads to quick exits and can lead the search engine to ignore it.
- Use plain text. Do not put HTML tags in the
contentattribute. - Avoid stuffing. A list of keywords reads badly and does not help.
Compare these two descriptions for the same page.
| Description | Problem or strength |
|---|---|
| `shoes, running shoes, trail shoes, cheap shoes, buy shoes` | A keyword list. It has no sentence and tells a reader nothing. |
| `Compare lightweight trail running shoes by grip, cushioning, and weight.` | A clear sentence that states what the page lets you do. |
Escaping characters in the content attribute
The description sits inside an attribute value, so quotes can break the markup. If you use double quotes around the value, a double quote inside the text ends the attribute early.
<!-- Broken: the second double quote ends the attribute -->
<meta name="description" content="Our "best" trail shoes for rocky ground.">
<!-- Fixed with a character reference -->
<meta name="description" content="Our "best" trail shoes for rocky ground.">
<!-- Fixed by avoiding the problem character -->
<meta name="description" content="Our best trail shoes for rocky ground.">Also write & for an ampersand when you want to be strictly correct. Make sure the file is saved as UTF-8 and that meta charset is declared, so accented letters and symbols in the description are read correctly.
Where the description sits in the head
A complete head that includes a description looks like this. The charset comes first, then the viewport, then the title and description.
<!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.">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Trail Running Shoes</h1>
</body>
</html>The order of the description relative to the title does not change how it works. The charset is the element where position matters, because it must appear within the first 1024 bytes of the document.
Edge cases and common errors
- Missing description. This is allowed and valid. The search engine will build a snippet from the page body. For pages with little visible text, such as an image gallery or an app shell, a description gives you more control.
- Duplicate descriptions. Two
meta name="description"elements in one head break the rule that only one is allowed. Validators report it, and search engines pick one without telling you which. - Generated pages. Templates and content systems often fill in one default description for every page. Check that each page type gets its own value. For product or article pages, build it from the page data.
- Wrong attribute. Writing
property="description"orname="descripton"(a typo) means the tag is not recognized. The page still loads without any error, so you will not notice unless you check. - Empty content.
content=""is valid but useless. Remove the element or fill it in. - Text that differs from the page language. Write the description in the same language as the page, and set
langon thehtmlelement. - Changes appear slowly. After you edit a description, search results do not update at once. The search engine must crawl the page again, and it may still show a body-text snippet.
- Client-side rendering. If JavaScript inserts the description after load, some crawlers may not see it. Put it in the HTML the server sends.
Descriptions and social previews
Link-sharing tools do not use the meta description in the same way. Platforms that read Open Graph tags prefer og:description when it is present. Many fall back to the standard meta description when it is not. A later chapter covers Open Graph. For now, remember that the two tags can hold different text, one tuned for search results and one for a shared link.
Checking your description
Open the page, then use the browser's developer tools. In the Elements panel, expand the head and find the meta element with name="description". Confirm that:
- there is exactly one such element,
- the attribute names are spelled correctly,
- the text is the text you intended.
To see the description without opening developer tools, view the page source. You can also run the page through the W3C Nu HTML Checker, which reports duplicate or malformed meta elements. Remember that the checker confirms the markup is valid. It cannot tell you which snippet a search engine will show. For that, search for your page and look at the result, and keep in mind that the snippet can vary by query.
Summary of the main points
- The meta description is
<meta name="description" content="...">, at most one per page. - Search engines treat it as a suggestion for the snippet and may use page text instead.
- It does not directly affect ranking, but a clear one can help people choose your result.
- Write a unique, accurate, plain-text sentence or two for each page, with the key point first.
- Escape quotes inside the attribute, and check the result in developer tools.
Exercise
A colleague says, "I set the meta description on our page, but Google shows different text under our result for some searches. Our markup must be broken." Is the markup necessarily broken? Give two other explanations.
Show answer
No. The meta description is only a suggestion. A search engine builds the snippet for each query and can use body text that matches the searcher's words better than the description does. Other explanations: the search engine has not yet crawled the page again since the description changed, or the description does not match the page content well enough to be trusted. Duplicate or misspelled description tags could also be the cause, so check the head in developer tools.
Exercise
This head has a problem with its description. Find it and fix it. <meta name="description" content="Our "fast" delivery service for small parcels.">
Show answer
The double quotes around fast end the content attribute early, so the value is cut off at "Our ". Fix it by using character references: <meta name="description" content="Our "fast" delivery service for small parcels."> Or remove the inner quotes: <meta name="description" content="Our fast delivery service for small parcels.">
Exercise
Rewrite this description so it is more useful to a searcher: <meta name="description" content="boots, hiking, boots for hiking, best hiking boots, cheap boots">
Show answer
Replace the keyword list with a short, accurate sentence that comes first with the key point, for example: <meta name="description" content="Waterproof hiking boots with ankle support, sorted by weight, price, and terrain type.">. It should be unique to that page, match what the page contains, and stay within about 120 to 160 characters.