Skip to content

HTML Tutorial Metadata and the Head

Social Metadata: Open Graph and Twitter Cards for Link Previews

Lesson 71 of 81 2 min read By Deepak Paswan Updated Oct 4, 2026

When someone shares a link, apps show a preview with a title, a description and an image. These come from Open Graph tags in your page’s head.

index.html
HTML
<meta property="og:type" content="website">
<meta property="og:title" content="Juniper Books">
<meta property="og:description" content="New and used books on Maple Street.">
<meta property="og:image" content="https://www.example.com/images/share.jpg">
<meta property="og:url" content="https://www.example.com/">
<meta name="twitter:card" content="summary_large_image">

What each tag does

TagPurpose
og:titleThe headline in the preview
og:descriptionThe short text under it
og:imageThe preview picture (use an absolute address)
og:urlThe preferred address
og:typewebsite, article and so on
twitter:cardThe card layout (summary or summary_large_image)

Image tips

Use an image of about 1200 by 630 pixels, with the important part in the middle. It must be reachable by a public absolute address, not a file on your computer.

You may not write these by hand

Content management systems and SEO plugins generate these tags for you. It is still useful to know what they are, and to be able to check them with each platform’s sharing debugger.

warning
Relative image addresses
Social sites cannot resolve images/share.jpg. Use the full address that starts with https://.