Definition
- The Open Graph protocol, originally created at Facebook, describes a page as an object with a title, a type, an image and a URL. Its tags are
<meta>elements in the page’s<head>, each with aproperty, such asog:title, and acontent. - ogp.me names four properties every page needs:
og:title,og:type,og:imageandog:url. Optional ones includeog:description,og:site_name,og:locale, andog:image:altto describe the image.
Why it matters
- A shared link shows as a preview with a title, a description and an image, taken from these tags. Without them, Facebook’s crawler makes a best guess from the page.
- WhatsApp asks for
og:title,og:descriptionandog:urlin<head>, not empty, and forog:imageas an absolute URL to an image under 600KB, at least 300 pixels wide and at most four times as wide as it is tall. The<head>must come within the first 300KB of the HTML. - For Arabic pages,
og:localedefaults toen_US, so declare the page’s own. Meta usesar_ARas its umbrella locale for Arabic.
Example
The tags of an Arabic product page, with its English version as an alternate locale:
html
<meta property="og:title" content="عسل السدر العماني" />
<meta property="og:description" content="عسل سدر عماني طبيعي، في عبوات من نصف كيلو." />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://example.com/sidr-honey" />
<meta property="og:image" content="https://example.com/images/sidr-honey.jpg" />
<meta property="og:image:alt" content="عبوة عسل سدر على طاولة خشبية" />
<meta property="og:site_name" content="متجر الواحة" />
<meta property="og:locale" content="ar_AR" />
<meta property="og:locale:alternate" content="en_US" />Common mistakes
- A relative image path, such as
/images/honey.jpg, where WhatsApp asks for an absolute URL. - A new image under the old URL: Facebook caches images by URL, and updates them only when the URL changes.
- The site’s name in
og:title: Meta and WhatsApp ask for the title without branding, and the name hasog:site_name. - Large inline styles or scripts before the tags, which can push them out of the first 300KB of the HTML, where WhatsApp asks for them.