Lesson 41 of 51 · Module 7, lesson 1 of 11 · 3 min

The head: title and description

Write page titles and descriptions that work on tabs, in search results and in link previews.

What you'll learn

  • How to write a good page title
  • What the meta description does, and how to write one
  • How pages look when they are shared on social media

Why this matters

Before anyone reads your page, they see its title and description: on the browser tab, in bookmarks, in search results, and in the preview when someone shares the link. These few words decide whether people click. They live in the <head>.

The title

html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Tomato soup in 30 minutes — Home Kitchen</title>
  <meta name="description" content="A warm tomato soup for four people, with six ingredients and step-by-step instructions.">
</head>
<body>
  <h1>Tomato soup in 30 minutes</h1>
  <p>A warm soup for four people.</p>
</body>
</html>

What you'll see: the title on the tab. The description does not appear on the page at all — it is for search engines and link previews.

A browser tab titled "Tomato soup in 30 minutes — Home Kitchen". The page shows the heading "Tomato soup in 30 minutes" and one paragraph.

Rules for a good title:

  • Specific and unique: every page on your site has its own title. "Home" on every page helps nobody.
  • Most important words first, then the site name: Page topic — Site name. Tabs cut long titles short, so the start matters most.
  • Around 50–60 characters is a good length for search results.
  • It usually matches the page's <h1>, but can be a little longer.

The meta description

<meta name="description" content="…"> is a one- or two-sentence summary of the page. Search engines often show it under the title in results.

  • Say what the reader gets: "A 30-minute tomato soup for four people, with six ingredients."
  • About 150 characters. Longer descriptions are cut off.
  • One description per page, written for that page.

Search engines may choose other text from your page instead — but a good description gives them the best option.

Previews on social media (optional)

When a link is shared in a chat app or on social media, the preview uses special tags if they exist. They start with og: (from "Open Graph", the system that defined them):

html
<meta property="og:title" content="Tomato soup in 30 minutes">
<meta property="og:description" content="A warm soup for four people, with six ingredients.">
<meta property="og:image" content="https://example.com/images/tomato-soup.jpg">

og:image needs a full address starting with https://, because the preview is built by another company's server, not from your folder. You can add these when your site is online.

What not to add

You may see <meta name="keywords" content="…"> in old tutorials. Search engines have ignored it for many years. Leave it out.

Try it yourself

  1. Select the example and choose Try it.
  2. Open your own index.html, about.html and recipe.html. Give each a specific title in the form Page topic — Site name, and a description.
  3. Open all three in browser tabs. Can you tell the tabs apart from the titles alone?

Common mistakes

  • The same title on every page. Tabs, bookmarks and search results all look alike. Fix: a unique title per page.
  • The site name first, as in "Home Kitchen — Tomato soup". On a narrow tab you only see "Home Kitchen". Fix: page topic first.
  • A description that repeats the title or is stuffed with keywords. Fix: one clear sentence about the page.
  • A relative og:image path. Previews cannot find it. Fix: a full https:// address, once the site is online.

Check yourself

  1. Where does the page title appear? Name two places.
  2. Does the meta description appear on the page?
  3. Should og:image use a relative path?

Answers

  1. Any two of: the browser tab, bookmarks, history, search results, link previews.
  2. No. It is for search results and previews.
  3. No. It needs a full https:// address.

Next: the rest of the head — the character set, the viewport, and the lines that connect CSS, JavaScript and icons.

Chat with us on WhatsApp