Overview
The <head> is the document’s contract with browsers, crawlers, and link previewers. Missing tags cause garbled text, tiny mobile rendering, blank social cards, and weak search snippets. The baseline checklist is in html.
Put charset and viewport first
<meta charset="utf-8"> must appear within the first 1024 bytes, before any content that could contain non-ASCII text, or the browser may guess the encoding wrong. The viewport tag follows; without it, mobile browsers render at a 980px desktop width.
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- remaining tags -->
</head>Write a unique, descriptive title
Every page needs its own <title>: concise, specific, with the site name at the start or end after a delimiter, such as “Specific page - Site name”. Google sets no character limit and truncates to fit the device width, so front-load the distinguishing words. Avoid vague titles such as “Home” and keyword repetition. Google may rewrite titles that do not match the page, so keep the title and the <h1> aligned.
Write the description for the snippet
Google builds snippets mostly from page content and uses the meta description when it describes the page better. There is no length limit; the snippet is truncated to fit. Write one or two sentences that help a reader decide to click.
<meta name="description" content="Required head tags in order: charset, viewport, title, description, canonical, Open Graph, and favicons." />Set a canonical on every indexable page
<link rel="canonical" href="https://example.com/this-page"> tells Google which URL you prefer when the same content is reachable several ways (protocol, trailing slash, tracking parameters). Google treats it as a strong signal, not a command, and picks a canonical itself if you give none. Use absolute URLs. See html-links-rel.
Add Open Graph and Twitter tags for shareable pages
They control the card shown when a URL is pasted into Slack, X, LinkedIn, or iMessage.
<meta property="og:type" content="article" />
<meta property="og:title" content="HTML Head Tags" />
<meta property="og:description" content="Required head tags in order." />
<meta property="og:url" content="https://example.com/frontend/html-head-tags" />
<meta property="og:image" content="https://example.com/og/html-head-tags.png" />
<meta name="twitter:card" content="summary_large_image" />Use an absolute og:image URL, ideally 1200x630. X falls back to og:title, og:description, and og:image when the twitter: equivalents are absent, so only twitter:card is usually needed. See og-images.
Tint browser chrome with theme-color
<meta name="theme-color" content="#fafaf9" media="(prefers-color-scheme: light)" />
<meta name="theme-color" content="#0b0b0c" media="(prefers-color-scheme: dark)" />Browsers that support it (mobile Chrome and Safari 15 and later among them) tint the toolbar. It is not Baseline across all engines, so treat it as an enhancement. The media form follows the OS preference only; see tailwind-dark-mode for a manual toggle.
Cover favicons with an SVG, a raster icon, and an Apple touch icon
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
<link rel="icon" href="/favicon.png" type="image/png" sizes="48x48" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />Google Search requires a square favicon of at least 8x8px and recommends larger than 48x48; keep a raster file because its documented formats are raster. An SVG scales cleanly and can respond to prefers-color-scheme.
Check for common omissions
- Duplicate
<meta name="description">tags from a CMS default plus a hand-written one. - Missing
og:image, which leaves a blank card. - A home page title that says “Home”.
- A render-blocking stylesheet placed before
charset.
For <script type="application/ld+json">, see structured-data. For preload, preconnect, and dns-prefetch, see html-links-rel. Next.js head management is in nextjs-metadata-api.