Last active
January 31, 2019 08:52
-
-
Save andrei99/e0665cede4db71a0a092fd8b2fe5a4b1 to your computer and use it in GitHub Desktop.
Custom items
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Open Graph result | |
$this->__component->SetResultCacheKeys(array( | |
"NAME", | |
"PREVIEW_TEXT", | |
"DETAIL_PICTURE", | |
"DETAIL_PAGE_URL" | |
)); | |
//Open Graph epilog | |
use Bitrix\Main\Page\Asset; | |
if($arResult): | |
Asset::getInstance()->addString('<meta property="og:image" content="https://' . $_SERVER['SERVER_NAME'] . $arResult['DETAIL_PICTURE']['SRC'] . '"/>'); | |
Asset::getInstance()->addString('<meta property="og:url" content= "https://'. $_SERVER['SERVER_NAME'] . $arResult['DETAIL_PAGE_URL'] . '"/>'); | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment