Write a complete head from nothing

Write every line of the head that a real page should have.

What to build

A complete document for an article.

Requirements

  • A doctype, lang="en", and the charset as the first element in the head.
  • A viewport line.
  • A title containing Dhaka and a description of at least 50 characters.
  • A stylesheet link to style.css and an icon link to icon.svg.
  • A script from app.js with defer.
  • A script with type="application/ld+json" containing valid JSON with "@type": "Article".
  • An h1 in the body.

Constraints

The script with src must be in the head.

Example

<script src="app.js" defer></script>

Why it works

Every line has a reader: the browser, a phone, a search engine or a chat app. defer means the script does not hold up the page.

Hints

Hint 1

Put the charset first.

Hint 2

defer goes on the script. rel="stylesheet" goes on the link.

Hint 3

JSON-LD uses a script whose type is application/ld+json.

Solution

Show one correct solution (try it yourself first)
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Walking tours of old Dhaka</title>
  <meta name="description" content="A guide to the best walking routes through the old city of Dhaka.">
  <link rel="stylesheet" href="style.css">
  <link rel="icon" href="icon.svg">
  <script src="app.js" defer></script>
  <script type="application/ld+json">{"@context":"https://schema.org","@type":"Article","headline":"Walking tours of old Dhaka"}</script>
</head>
<body>
  <h1>Walking tours of old Dhaka</h1>
</body>
</html>

Lesson: The head: titles, search results and sharing →