HTML / LESSON 14

Describe your page with titles and metadata

Write useful page information for browser tabs, search previews, and shared links.

Content updated

By the end, you can…

  • Place basic metadata in the document head.
  • Distinguish supplied metadata from the preview a service may choose to show.
Before you begin

One idea at a time

The head contains information about a document rather than its visible article. You already used title, character encoding, and the viewport setting. Now add a description that summarizes what this particular page offers. A useful description is a short explanation for a person, not a list of repeated keywords.

A title should identify this page and distinguish it from neighboring pages. Garden notebook is suitable for a homepage, while How I water basil describes a specific entry. Keep the visible h1 and the document title consistent in meaning, even though they do not need to be identical word for word.

Search engines decide what to display in their results. They may use a description or choose text from the page. Adding metadata does not guarantee indexing, ranking, or an exact snippet. This lesson's preview is an illustration of the information you supplied, not a live search result.

Recall the syntax: head wraps the page information, title wraps the browser-tab text, and meta is a void element with no closing tag. On a description meta element, name identifies the kind of information and content holds its value. It stays in head and does not create a visible paragraph. The earlier charset and viewport settings are meta elements too, with different attributes.

Separate the tab name from page settings

Remember first

Write a clear title and an accurate description. Search engines choose how to display them.

Focus on these values

<title>Browser-tab name
Write specific text between title and its closing tag. It belongs in head.
<meta name="description">Page summary
Put the actual summary in the content attribute. It is not a visible paragraph or a promise of search ranking.

Keep the document structure

<head>Container for page information
Holds title and meta, separate from body.
<meta>A document setting
A void element. Keep charset and viewport. Sharing fields reuse meta with property naming the field and content supplying its value.

Walk through an example

html
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>How I water basil — Garden notebook</title>
  <meta name="description" content="My simple routine for checking basil soil and watering gently.">
</head>

The title names a specific entry and its notebook. The description explains what a reader will learn. Both belong in head. charset supports the text encoding, and viewport helps mobile browsers use an appropriate layout width. None of these elements inserts a visible paragraph into body.

See it happen: try a small change

Preview the information you supply

Compare a vague description with a specific one. This is an illustrative preview, not a live search result or ranking prediction.

Code to notice

<title>My page</title>
<meta name="description" content="Welcome to my website.">

Live result

My page
index.htmlPreview

What changed: The title and description say little about what this particular page offers. The next version is more informative.

Sharing information and search information are related

Metadata means information describing the page. Open Graph is a set of metadata fields understood by many sharing services. It can suggest the title, description, image, and URL used when a page is shared. Platforms can handle and cache these fields differently. For a published page, use the actual public URL and an accessible absolute image URL. A filename that only exists on your computer cannot become a working social preview image. The example.com addresses below are placeholders, not resources provided by this lesson; leave those optional fields out until you have real public URLs.

The sharing example still uses meta, not a new tag. property names an Open Graph field, such as og:title for the shared title or og:image for the image URL. content supplies that field's value. These sharing fields use property rather than the name attribute used by the ordinary page description.

A meta keywords tag is not a useful Google ranking technique. A meta refresh is not needed for an ordinary beginner page and can interrupt reading by reloading or redirecting it. Concentrate on clear titles, accurate descriptions, useful content, and links that work before exploring more specialized metadata.

The viewport setting alone does not solve narrow-screen layout problems. Content must still fit. Metadata also does not replace accessible headings, image alternatives, or form labels in the body. Each part of the document has a different job; use the appropriate place for the information you want to communicate.

html
<meta property="og:title" content="How I water basil">
<meta property="og:description" content="A simple soil-checking routine.">
<meta property="og:url" content="https://example.com/basil.html">
<meta property="og:image" content="https://example.com/images/basil.jpg">

Try it in your browser

Edit the existing head in your HTML document; do not paste a second head inside body. Replace its title and add one description meta element, keeping charset and viewport. Save and refresh to check the tab. Read the description in your editor; it does not become visible page text. Sharing URLs are optional and must describe a page you have actually published.

A common wrong turn

Do not treat the illustrative preview as a promise of what Google or a sharing app will display. Also avoid reusing one vague description on every page. Match the title and description to the actual content being offered.

Change one thing

Compare a vague title with a specific one in the preview. Then read only the description and predict the content. If the body does not deliver that content, revise the description.

Your turn: describe your notebook page

Improve the head of your notebook page with a specific title and an accurate one-sentence description. Keep the character encoding and viewport settings. Add sharing fields only if you can explain their intended values.

Try this in your own HTML file, then open the page in a browser. There is no separate checked practice for this task yet.

  1. Write a title that distinguishes this page from another entry.
  2. Put the description in head and keep the visible introduction in body.
  3. Open the tab and inspect the page source. Explain why the description is not a visible paragraph or a ranking guarantee.

Optional related practice: Build your first complete HTML webpage →

Go to the source

Examples are authored for Tuklas and checked with code and reference documentation. This is not a claim of independent human review. Suggest a correction.