Open Graph Markup Setup for Bitrix CMS
Open Graph — a protocol from Facebook (Meta) that all major social networks and messengers adopted. When user shares a link on VKontakte, Telegram or WhatsApp, platform reads OG tags and forms preview: title, description, image. Without these tags, preview is formed arbitrarily — usually incorrectly.
Basic Tag Set
Minimal OG tag set for product:
<meta property="og:type" content="product">
<meta property="og:title" content="Product Name">
<meta property="og:description" content="Short description for social media">
<meta property="og:image" content="https://your-site.ru/upload/iblock/abc/image.jpg">
<meta property="og:url" content="https://your-site.ru/catalog/section/element/">
<meta property="og:site_name" content="Store Name">
For articles and blog pages og:type = article. For homepage — website.
Implementation in Component Template
In bitrix:catalog.element template, add tag output via $APPLICATION->AddHeadString():
$title = htmlspecialchars($arResult['NAME']);
$desc = htmlspecialchars(strip_tags($arResult['PREVIEW_TEXT'] ?: $arResult['DETAIL_TEXT']));
$desc = mb_substr($desc, 0, 200);
$imgSrc = $arResult['DETAIL_PICTURE']['SRC'] ?? $arResult['PREVIEW_PICTURE']['SRC'] ?? '';
$imgFull = (!empty($imgSrc)) ? 'https://' . $_SERVER['HTTP_HOST'] . $imgSrc : '';
$url = 'https://' . $_SERVER['HTTP_HOST'] . $arResult['DETAIL_PAGE_URL'];
$APPLICATION->AddHeadString('<meta property="og:type" content="product">');
$APPLICATION->AddHeadString('<meta property="og:title" content="' . $title . '">');
$APPLICATION->AddHeadString('<meta property="og:description" content="' . $desc . '">');
$APPLICATION->AddHeadString('<meta property="og:url" content="' . $url . '">');
if ($imgFull) {
$APPLICATION->AddHeadString('<meta property="og:image" content="' . $imgFull . '">');
$APPLICATION->AddHeadString('<meta property="og:image:width" content="1200">');
$APPLICATION->AddHeadString('<meta property="og:image:height" content="630">');
}
AddHeadString() adds string to page <head> — Bitrix automatically outputs everything added this way when calling $APPLICATION->ShowHead() in site template.
Twitter Cards
Twitter/X uses its own set of twitter:* tags. Added alongside OG tags:
$APPLICATION->AddHeadString('<meta name="twitter:card" content="summary_large_image">');
$APPLICATION->AddHeadString('<meta name="twitter:title" content="' . $title . '">');
$APPLICATION->AddHeadString('<meta name="twitter:description" content="' . $desc . '">');
$APPLICATION->AddHeadString('<meta name="twitter:image" content="' . $imgFull . '">');
Image Requirements
- Minimum size: 200×200 px, optimal: 1200×630 px (1.91:1 ratio).
- Format: JPEG or PNG. WebP not supported everywhere.
- File size: up to 8 MB (Facebook limit).
- HTTPS: image must be accessible via HTTPS, otherwise platforms won't show preview.
For Bitrix: if product main image is vertical (portrait), create separate OG image via additional property OG_IMAGE of type "File" and use in markup.
Debugging OG Tags
-
Facebook Sharing Debugger:
developers.facebook.com/tools/debug/— shows how Facebook sees page, forces cache update. -
Telegram: simply send link to
@TelegramBotInspectorbot or any chat — Telegram shows preview. -
VKontakte:
vk.com/dev/pages_debugger— similar debugger.
Implementation Timeline
Setting up Open Graph markup for product card, catalog sections, static pages — 2–4 hours.







