Describe Pages in the Head

The garden’s site now has an FAQ, an hours popover, gentle motion, and a dark mode. All of that lives in <body>. However, the site also shows up in places you haven’t designed yet: a search result, a browser tab, and the preview card a chat app draws when someone shares a link. Each of those reads <head>.

In this lesson, you’ll write the home page’s head so that each of those places shows the garden properly. You’ll also learn which tag feeds which place, so you can use the same approach for any page.

Describe the Page for Search Results

A search result has two parts that you can influence: a headline and a line or two of text under it. The headline usually comes from <title>, which also names the tab. The home page’s title, Elm Street Community Garden, is already unique on the site, as every page’s should be.

The text under the headline can come from a meta description. A <meta> element carries information about the page as a name and a value, and the browser doesn’t display it. Open index.html and add this line after <title>:

Language: HTML
    <meta name="description"
      content="A volunteer-run garden on Elm Street with 24 plots,
        Saturday work days and a seed swap. Visit, volunteer or
        apply for a plot.">

The line breaks inside the quotes only keep the code readable: search engines read them as spaces. Save, and the page looks the same, because the description is for search engines. They often show it under your title, but they may pick other text from the page instead, so treat it as a suggestion. Aim for one or two sentences, about 150 characters, that make someone want to click.

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.