Your first document
Language and description
Declare the page language and write a concise meta description that helps assistive technology and search results understand the document.
Two small additions in the head make your page easier to understand for people and for software.
First, declare the document language on the opening html tag:
<html lang="en">
The lang attribute tells screen readers which pronunciation rules to use. It also helps translation tools and search engines classify the content correctly.
Use the language the page is actually written in. For Italian, use lang="it". For Brazilian Portuguese, use lang="pt-BR" when that regional distinction matters to your readers.
Second, add a short description in the head:
<meta
name="description"
content="Notes from a three-day cycling trip around Copenhagen."
>
This text does not appear in the page body. Search engines may show it below the page title in results, although they sometimes pick a different excerpt from the page itself.
Write the description for a person deciding whether your page answers their question. Be specific. A vague list of keywords helps nobody.
Here is how these pieces fit into a complete shell:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Notes from a cycling trip.">
<title>Copenhagen cycling notes</title>
</head>
<body>
<h1>Copenhagen cycling notes</h1>
</body>
</html>
When you build your personal page in the practice lessons, set lang to match your writing and write a description that fits your content. Both take a minute and pay off every time someone lands on your page from a search result or a shared link.
If you write in more than one language on the same site, each page should declare the language of that page’s main content. Mixed-language pages are harder for tools to handle well than separate pages with clear lang values.
Lesson completed