Created
February 12, 2019 12:41
-
-
Save konratnox/583b505d2abbab21f268efb3e9b8249b to your computer and use it in GitHub Desktop.
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
<? | |
if ($arResult['ARR_NAV']["NavPageNomer"] == 2) { | |
// $APPLICATION->SetPageProperty("robots", "noindex, follow"); | |
Bitrix\Main\Page\Asset::getInstance()->addString("<link rel='prev' href='https://{$_SERVER['SERVER_NAME']}{$arResult['LIST_PAGE_URL']}'>"); | |
} | |
elseif ($arResult['ARR_NAV']["NavPageNomer"] > 2) { | |
// $APPLICATION->SetPageProperty("robots", "noindex, follow"); | |
$prevPage = $arResult['ARR_NAV']["NavPageNomer"] - 1; | |
Bitrix\Main\Page\Asset::getInstance()->addString("<link rel='prev' href='https://{$_SERVER['SERVER_NAME']}{$arResult['LIST_PAGE_URL']}?PAGEN_{$arResult['ARR_NAV']["NavNum"]}={$prevPage}'>"); | |
} | |
if ($arResult['ARR_NAV']["NavPageNomer"] < $arResult['ARR_NAV']["NavPageCount"]) { | |
$nexPage = $arResult['ARR_NAV']["NavPageNomer"] + 1; | |
Bitrix\Main\Page\Asset::getInstance()->addString("<link rel='next' href='https://{$_SERVER['SERVER_NAME']}{$arResult['LIST_PAGE_URL']}?PAGEN_{$arResult['ARR_NAV']["NavNum"]}={$nexPage}'>"); | |
} | |
Bitrix\Main\Page\Asset::getInstance()->addString("<link rel='canonical' href='https://{$_SERVER['SERVER_NAME']}{$arResult['LIST_PAGE_URL']}'/>"); |
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
<? | |
$arNavResult = array(); | |
$arNavResult['NavNum'] = $arResult['NAV_RESULT']->NavNum; | |
$arNavResult['NavPageNomer'] = $arResult['NAV_RESULT']->NavPageNomer; | |
$arNavResult['NavPageCount'] = $arResult['NAV_RESULT']->NavPageCount; | |
$arResult['ARR_NAV'] = $arNavResult; | |
$this->__component->SetResultCacheKeys(array('ARR_NAV')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment