HTML Meta Tags Cheatsheet - Meta Tags SEO & Configuration Reference

For developers who want their pages to rank, share cleanly, and be safe. Meta tags are invisible yet decide what search engines index, what a link preview shows on WeChat/Twitter, and how the browser treats the page origin. By the end you can wire up title/description and Open Graph for rich link previews, set viewport for mobile, configure theme-color and a PWA manifest, and add basic Content-Security-Policy guidance.

Web Services·36 commands·Last updated 2026-07-21

Document Metadata 5

<meta charset="UTF-8">
Character encoding (recommended HTML5 form)
<meta name="viewport" content="width=device-width, initial-scale=1">
Mobile viewport adaptation
<meta name="description" content="Page description">
SEO page description (keep under ~150 chars)
<meta name="keywords" content="keyword1, keyword2">
SEO keywords (ignored by modern search engines)
<meta name="author" content="Author name">
Page author information

SEO 6

<meta name="robots" content="index, follow">
Allow indexing and link following
<meta name="robots" content="noindex, nofollow">
Block indexing and link following
<meta name="googlebot" content="noindex">
Block indexing by Google only
<link rel="canonical" href="https://example.com/page">
Canonical URL to avoid duplicate-content penalties
<link rel="alternate" hreflang="en" href="https://example.com/en/">
Declare the English language version
<link rel="alternate" hreflang="x-default" href="https://example.com/">
Default language version

Social Sharing (Open Graph + Twitter) 6

<meta property="og:title" content="Title">
Share card title
<meta property="og:description" content="Description">
Share card description
<meta property="og:image" content="https://example.com/img.jpg">
Share preview image (recommended 1200x630)
<meta property="og:url" content="https://example.com">
Shared page URL
<meta property="og:type" content="website">
Content type (article/website)
<meta name="twitter:card" content="summary_large_image">
Twitter card type

Cache Control 4

<meta http-equiv="Pragma" content="no-cache">
Disable cache (HTTP/1.0)
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
Disable cache (HTTP/1.1)
<meta http-equiv="Expires" content="0">
Expire immediately
<meta http-equiv="Cache-Control" content="max-age=3600">
Cache for 1 hour

Mobile Adaptation 6

<meta name="format-detection" content="telephone=no">
Disable auto phone-number detection
<meta name="theme-color" content="#6366f1">
Browser address-bar theme color
<meta name="apple-mobile-web-app-capable" content="yes">
iOS full-screen mode
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
iOS status-bar style
<meta name="mobile-web-app-capable" content="yes">
Chrome Android full-screen mode
<meta name="application-name" content="App name">
Home-screen icon name

Security 5

<meta http-equiv="Content-Security-Policy" content="default-src 'self'">
CSP restricts loadable resource sources
<meta http-equiv="Content-Security-Policy" content="frame-ancestors 'self'">
CSP prevents clickjacking
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Force IE to use the latest rendering engine
<meta name="referrer" content="no-referrer">
Send no Referer header
<meta name="referrer" content="strict-origin-when-cross-origin">
Send origin only cross-origin (browser default)

Auto Refresh & Redirect 4

<meta http-equiv="refresh" content="30">
Auto-refresh the page every 30s
<meta http-equiv="refresh" content="5; url=https://example.com/">
Redirect to a new URL after 5s
<meta http-equiv="Cache-Control" content="no-cache">
Practical: pair with refresh to always fetch fresh
<meta http-equiv="Pragma" content="no-cache">
Practical: HTTP/1.0 fallback used with refresh

Command Examples

A minimal meta set that passes both SEO and social preview checks

<meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="A one- or two-sentence summary of this page, written for a search result snippet."> <link rel="canonical" href="https://example.com/page"> <meta property="og:title" content="Page title shown on the social share card"> <meta property="og:description" content="Short description shown beneath the title on the social share card."> <meta property="og:image" content="https://example.com/img.jpg"> <meta property="og:url" content="https://example.com"> <meta property="og:type" content="website"> <meta name="twitter:card" content="summary_large_image">

charset has to come first, otherwise already-downloaded bytes may be decoded wrongly and render as mojibake. og:image needs an absolute URL at roughly 1200x630; undersized images get cropped or padded by the platforms.

Multilingual pages: canonical and hreflang each solve one problem

<link rel="canonical" href="https://example.com/"> <link rel="alternate" hreflang="en" href="https://example.com/en/"> <link rel="alternate" hreflang="x-default" href="https://example.com/">

canonical consolidates duplicate addresses for the same content, while hreflang declares the mapping between language versions. x-default is where unmatched visitors land, and leaving it out sends some users to a page in the wrong language.

A temporary holding page: redirect after five seconds, with no-cache to force a fresh fetch

<meta http-equiv="refresh" content="5; url=https://example.com/"> <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"> <meta http-equiv="Pragma" content="no-cache">

Suited to domain moves or maintenance pages; the Pragma line is kept for older clients that only honour HTTP/1.0 cache directives. Remove the whole block once the migration is done, or the holding page itself gets indexed and lingers.

Dual-theme pages: theme-color switching with a media query

<meta name="theme-color" content="#6366f1" media="(prefers-color-scheme: light)"> <meta name="theme-color" content="#0f172a" media="(prefers-color-scheme: dark)"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">

Keep the dark value close to your page background, otherwise a visible seam appears between the chrome and the content. In iOS fullscreen mode the status bar overlays the content, so the layout needs matching safe-area padding.

Common Pitfalls

  • A meta http-equiv Content-Security-Policy only governs content that appears before it, and multiple instances do not merge — the first one wins. Prefer delivering frame-ancestors and default-src as a real response header.
  • The keywords meta is ignored by modern search engines. Stuffing it brings no benefit and reads as suspicious; it is not a density optimisation lever.
  • Turning off format-detection removes one-tap dialling, which changes the mobile form experience on pages that publish a support hotline. Confirm you no longer need tap-to-call first.
  • X-UA-Compatible is a leftover for IE that modern browsers do not parse at all. Keeping it is harmless, but never expect it to fix any rendering problem.
  • Choosing referrer no-referrer also strips referrer data from your own outbound traffic, which breaks analytics and callbacks. Use strict-origin-when-cross-origin instead.

Tips

  • The viewport meta is mandatory on mobile, otherwise the page renders at desktop width.
  • Open Graph tags make links render preview cards on Facebook, LinkedIn, etc.; og:image should be 1200x630px.
  • Twitter Cards need separate setup and are not interchangeable with Open Graph; configure both.
  • theme-color changes the mobile browser's address-bar color; use the media attribute for dark-mode-specific values.
  • canonical and hreflang are critical for multilingual SEO and effectively prevent duplicate-content penalties.

FAQ

Do title and og:title both need to be written, and does duplication hurt?

Yes, both, because they serve different consumers. title is what search engines and the browser tab read, while og:title is what social platform crawlers pick up when building a share card — those crawlers only look at Open Graph and Twitter Card properties. Writing both does not count as duplicate content since they render in different places. The real care point is that they should not contradict each other: an og:title far from the visible page title makes the shared card look unlike the landing page.

What happens when robots and googlebot are both declared?

Each is evaluated independently, and they are not redundant: the robots meta applies to every crawler that follows the generic convention, while googlebot targets only Google. Writing googlebot with noindex alone is therefore enough to keep Google out while other engines still index the page, which is exactly the case the distinction exists for. If the two carry opposite instructions, behaviour diverges per crawler, and that split is among the hardest things to diagnose when indexing misbehaves — in practice, either make them agree or drop one entirely.

Should canonical point at the URL with query parameters or without?

Point it at the parameterless canonical address. URLs carrying UTM tags, sort order or filter parameters can generate a large number of equivalent pages, and canonical exists to funnel all of them into one authoritative address so ranking signals are not split. hreflang operates at a different layer: a multilingual site declares each language version with alternate hreflang and marks the fallback with x-default. Canonical answers "same content, several addresses", hreflang answers "different languages, different addresses" — they coexist independently.

Is setting Cache-Control through a meta http-equiv still meaningful on modern sites?

Only to a limited degree, since caching is primarily governed by response headers. A meta http-equiv Cache-Control is honoured only in some cases, and only when it appears early in the document — placed later it tends to be ignored. Its real value is in static exports or local file previews where no genuine response header exists, which makes it handy for temporary debugging and forcing a fresh fetch. A production site should emit Cache-Control as a response header and treat the meta variant as a supplement rather than the main mechanism.

Can theme-color cover both dark and light schemes?

Yes, but the light value needs a media attribute so it only applies to the matching preference, with the dark value left unconditioned as the fallback. Dark-mode users are keyed off their system setting, so two rules separated by prefers-color-scheme cover both cases within one group. The toolbar colour is purely decorative and getting it wrong breaks nothing functionally, but a bright value on a dark background is glaring — so this tag should switch with your dual-theme work instead of being hard-coded globally.

Official References

Each command links to its official documentation below, so you can verify the latest usage and read deeper.

Maintained by LaoHand

Publicly updated on Jul 21, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us