69 lines
1.5 KiB
Markdown
69 lines
1.5 KiB
Markdown
![]() |
---
|
||
|
id: 61329d52e5010e08d9b9d66b
|
||
|
title: Step 4
|
||
|
challengeType: 0
|
||
|
dashedName: step-4
|
||
|
---
|
||
|
|
||
|
# --description--
|
||
|
|
||
|
Un altro elemento `meta` importante per l'accessibilità e la SEO è la definizione `description`. Il valore dell'attributo `content` è usato dai motori di ricerca per dare una descrizione della tua pagina.
|
||
|
|
||
|
Aggiungi un elemento `meta` con l'attributo `name` impostato a `description`, e dagli un attributo `content` utile.
|
||
|
|
||
|
# --hints--
|
||
|
|
||
|
Dovresti aggiungere un nuovo elemento `meta` a `head`.
|
||
|
|
||
|
```js
|
||
|
assert.equal(document.querySelectorAll('meta').length, 3);
|
||
|
```
|
||
|
|
||
|
Dovresti dare a `meta` un attributo `name` con valore di `description`.
|
||
|
|
||
|
```js
|
||
|
assert.exists(document.querySelector('meta[name="description"]'));
|
||
|
```
|
||
|
|
||
|
Dovresti dare a `meta` un attributo `content`.
|
||
|
|
||
|
```js
|
||
|
assert.notEmpty(document.querySelector('meta[name="description"]')?.content);
|
||
|
```
|
||
|
|
||
|
Il valore dell'attributo `content` non deve superare una lunghezza di 165 caratteri. _Questa è la lunghezza massima della descrizione permessa da Google._
|
||
|
|
||
|
```js
|
||
|
assert.isAtMost(document.querySelector('meta[name="description"]')?.content?.length, 165);
|
||
|
```
|
||
|
|
||
|
# --seed--
|
||
|
|
||
|
## --seed-contents--
|
||
|
|
||
|
```html
|
||
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
--fcc-editable-region--
|
||
|
<head>
|
||
|
<meta charset="UTF-8" />
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
|
<link rel="stylesheet" href="styles.css" />
|
||
|
</head>
|
||
|
--fcc-editable-region--
|
||
|
<body>
|
||
|
|
||
|
</body>
|
||
|
</html>
|
||
|
|
||
|
```
|
||
|
|
||
|
```css
|
||
|
body {
|
||
|
background: #f5f6f7;
|
||
|
color: #1b1b32;
|
||
|
font-family: Helvetica;
|
||
|
margin: 0;
|
||
|
}
|
||
|
```
|