Skip to content

Instantly share code, notes, and snippets.

@golubev-alex
Last active January 9, 2023 07:55
Show Gist options
  • Save golubev-alex/6ea35c61777597bc23e13ec033b9ebdc to your computer and use it in GitHub Desktop.
Save golubev-alex/6ea35c61777597bc23e13ec033b9ebdc to your computer and use it in GitHub Desktop.
// envybox
https://envybox.io/help/knowledge-base/jsapi-vidzhetov-opisanie-metodov/
// микроразметка
<?
$og='<!-- OpenGraph -->'."\n";
$og.='<meta property="og:title" content="'.$arResult["NAME"].'" />'."\n";
$og.='<meta property="og:url" content="https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . '" />'."\n";
$og.='<meta property="og:image" content="https://' . $_SERVER['SERVER_NAME'] . $arResult["DETAIL_PICTURE"]["SRC"] . '" />'."\n";
$og.='<meta property="og:description" content="'.$arResult["PREVIEW_TEXT"].'" />'."\n";
$og.='<meta property="og:type" content="article" />'."\n";
$og.='<meta property="og:site_name" content="mylablife.ru" >'."\n";
$og.='<meta property="og:locale" content="ru" />'."\n";
$og.='<!-- OpenGraph END-->';
$APPLICATION->AddHeadString($og,true);
?>
<?
$currUrl = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$dataSchema = array(
'@context' => 'http://www.schema.org',
'@type' => 'NewsArticle',
'url' => $currUrl,
'publisher' => array(
'@type' => 'Organization',
'name' => 'mylablife.ru',
'logo' => array(
'@type' => 'ImageObject',
'image' => '/bitrix/templates/furniture_blue/assets/i/logo.png',
'url' => '/bitrix/templates/furniture_blue/assets/i/logo.png'
)
),
'headline' => $arResult['NAME'],
'mainEntityOfPage' => $currUrl,
'articleBody' => strip_tags($arResult["DETAIL_TEXT"]),
'image' => $arResult["DETAIL_PICTURE"]["SRC"],
'author' => 'Редакция сайта LABLIFE',
'datePublished' => ConvertDateTime($arResult["ACTIVE_FROM"], "YYYY-MM-DD HH:MI:SS", "ru"),
'dateModified' => ConvertDateTime($arResult["TIMESTAMP_X"], "YYYY-MM-DD HH:MI:SS", "ru"),
);
$jsonSchema = json_encode($dataSchema,JSON_UNESCAPED_UNICODE);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment