Reference · Beginner
The meta element
Add document metadata such as encoding, viewport behavior, and descriptions without treating metadata as a ranking guarantee.
- Published
- Last checked
Definition
The meta element represents metadata that cannot be expressed by another
dedicated metadata element such as title or link.
Common syntax
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="A concise, page-specific summary." />
Context and attributes
Place metadata in head. The character encoding should appear early. Common
forms use charset or matching name and content values.
Use one UTF-8 charset declaration near the beginning of the document. The viewport declaration should normally preserve user zoom; values that disable scaling create an accessibility barrier. Metadata belongs to the current document and should be generated from the same validated facts used in visible content.
Practical consequences
The viewport declaration lets responsive CSS use the device-width layout viewport. A description can be considered for search presentation, but a retrieval system may choose different visible text.
Write a unique description that summarizes the page’s actual answer or value. It is presentation guidance, not hidden ranking copy. Search and social systems may truncate, rewrite, or ignore it based on the query and available content.
Robots directives
A robots meta directive can control indexing and link following for the current
HTML document. Use noindex for pages that should remain reachable but absent
from search results, such as a private-search interface. Do not use noindex as
a security control: anyone with the URL may still request the page.
Crawler-specific directives should be rare and documented. Ensure robots.txt
does not block a crawler from seeing a page whose noindex directive it must
process.
Metadata beyond meta
The document title uses title; canonical URLs and alternate relationships use
link. Open Graph properties commonly use meta property, while standard
metadata often uses meta name. Each system has its own contract, so do not
copy arbitrary tag lists without verifying support.
Canonical URLs should be absolute, use the production HTTPS host, and resolve successfully. They consolidate duplicate access paths; they do not rescue substantially different pages or guarantee indexation.
Security and privacy
Do not serialize secrets, personal data, unpublished prompts, or internal build notes into metadata. Although tags are not visible in the main layout, they are public source. Escape untrusted values so they cannot break out of an attribute or script context.
Common misuse
Do not add unsupported names, repeat keyword lists, or claim that one tag guarantees indexing. Metadata must match the visible page and production URL.
Verification checklist
- Inspect the rendered production
head, not only a source template. - Confirm one charset, one viewport, a unique title, and a useful description.
- Verify canonical and social URLs on the apex host.
- Compare robots metadata with robots.txt and sitemap membership.
- Check that titles and descriptions contain no secrets or internal notes.
- Use a search preview as guidance, then verify actual indexed behavior in webmaster tools.