How to Write Meta Tags for SEO and Link Previews

Which meta tags matter: title, description, canonical, robots, Open Graph and Twitter cards, with length limits and common mistakes.

A handful of tags in the head of a page decide how it appears in search results and in the preview card when someone shares the link. Most pages only need a short, correct set.

Title and description

The title is the clickable headline in search results. Keep it under about 60 characters, put the main topic first and make each page's title unique. The meta description does not affect ranking directly, but it is often shown as the snippet, so write about 150 to 160 characters that describe the page honestly.

Search engines may rewrite either one when they think another text fits the query better.

Canonical and robots

A canonical link tells search engines which URL is the preferred version when the same content is reachable at several addresses, for example with tracking parameters. The robots meta tag controls indexing: noindex keeps the page out of results and nofollow asks crawlers not to follow its links. Index and follow are the defaults, so you only need the tag to change them.

Open Graph and Twitter cards

Open Graph tags (og:title, og:description, og:image, og:url, og:type) control the card shown when a link is shared on most social platforms and chat apps. Twitter/X reads them too, but twitter:card chooses the layout, summary_large_image for a big picture or summary for a small one.

Use an absolute HTTPS image URL around 1200 by 630 pixels, because some platforms cache the first image they see.

Check the result

After you publish, preview how the page looks when shared and make sure the canonical URL matches the address you want indexed. Duplicate or missing titles and descriptions are the most common issues found in SEO audits.

Related tools

All guides