Добавлены канонические урлы + prev и next для постранички каталога
<?php
$arResult['NAV_RESULT_NAV_NUM'] = $arResult['NAV']->NavNum;
$arResult['NAV_RESULT_NAV_PAGE_NOMER'] = $arResult['NAV']->NavPageNomer;
$arResult['NAV_RESULT_NAV_PAGE_COUNT'] = $arResult['NAV']->NavPageCount;
$arResult['SECTION_SECTION_PAGE_URL'] = !empty($arResult['SECTION']['SECTION_PAGE_URL']) ? $arResult['SECTION']['SECTION_PAGE_URL'] : null;
$cacheResultKeys = array_merge(
$cacheResultKeys,
[
'NAV_RESULT_NAV_NUM',
'NAV_RESULT_NAV_PAGE_NOMER',
'NAV_RESULT_NAV_PAGE_COUNT',
'SECTION_SECTION_PAGE_URL',
]
);
<?php
if (
isset($arResult['NAV_RESULT_NAV_NUM'], $arResult['NAV_RESULT_NAV_PAGE_NOMER'], $arResult['SECTION_SECTION_PAGE_URL'])
&& (
array_key_exists('PAGEN_' . $arResult['NAV_RESULT_NAV_NUM'], $_GET)
|| $arResult['NAV_RESULT_NAV_PAGE_NOMER'] > 1
)
) {
$APPLICATION->SetPageProperty('canonical', 'http://' . $server->getHttpHost() . $arResult['SECTION_SECTION_PAGE_URL']);
}
if (
isset(
$arResult['NAV_RESULT_NAV_NUM'],
$arResult['NAV_RESULT_NAV_PAGE_NOMER'],
$arResult['NAV_RESULT_NAV_PAGE_COUNT'],
$arResult['SECTION_SECTION_PAGE_URL']
)
) {
$paramName = sprintf('PAGEN_%s', $arResult['NAV_RESULT_NAV_NUM']);
if ($arResult['NAV_RESULT_NAV_PAGE_COUNT'] > $arResult['NAV_RESULT_NAV_PAGE_NOMER']) {
// next
$urlNextRel = htmlspecialcharsbx(
CHTTP::urlAddParams(
CHTTP::urlDeleteParams(
$arResult['SECTION_SECTION_PAGE_URL'],
$paramName,
[
'delete_system_params' => true
]
),
[
$paramName => $arResult['NAV_RESULT_NAV_PAGE_NOMER'] + 1,
],
[
'skip_empty' => true,
]
)
);
}
if ($arResult['NAV_RESULT_NAV_PAGE_NOMER'] > 1) {
// prev
$urlPrevRel = htmlspecialcharsbx(
CHTTP::urlAddParams(
CHTTP::urlDeleteParams(
$arResult['SECTION_SECTION_PAGE_URL'],
$paramName,
[
'delete_system_params' => true
]
),
[
$paramName => (
($arResult['NAV_RESULT_NAV_PAGE_NOMER'] - 1) == 1
? ''
: $arResult['NAV_RESULT_NAV_PAGE_NOMER'] - 1
),
],
[
'skip_empty' => true,
]
)
);
}
if (isset($urlNextRel)) {
$APPLICATION->SetPageProperty('next', 'http://' . $server->getHttpHost() . $urlNextRel);
}
if (isset($urlPrevRel)) {
$APPLICATION->SetPageProperty('prev', 'http://' . $server->getHttpHost() . $urlPrevRel);
}
}
https://www.olegpro.ru/post/1s_bitriks_kastomnye_kanonicheskie_urly__relprev_i_relnext.html
<?php
$APPLICATION->AddBufferContent([$APPLICATION, 'GetLink'], 'prev');
$APPLICATION->AddBufferContent([$APPLICATION, 'GetLink'], 'next');