I will not describe why this is necessary, I will only publish a ready-made solution.
else echo $APPLICATION->ShowProperty("meta_title");
if (isset($_GET['PAGEN_1']) && $_GET['PAGEN_1']!=1) { echo " Page ".$_GET['PAGEN_1']; }
if (isset($_GET['PAGEN_2']) && $_GET['PAGEN_2']!=1) { echo " Page ".$_GET['PAGEN_2']; }
if (isset($_GET['PAGEN_3']) && $_GET['PAGEN_3']!=1) { echo " Page ".$_GET['PAGEN_3']; }
The disadvantage of this condition is that the listing is manual, and if you have 100 pages of pagination, this copy-paste will not be very comfortable. But in Bitrix there is no comfort at all.
A detailed version from some project with which I worked for the SEO customization:
if(preg_match ('/catalog\/(.*)\/\?PAGEN_1=2+/i', $_SERVER['REQUEST_URI'])) {
echo $APPLICATION->ShowTitle(); echo ' - page № 2';
}
else if(preg_match ('/catalog\/(.*)\/\?PAGEN_1=3+/i', $_SERVER['REQUEST_URI'])) {
echo $APPLICATION->ShowTitle(); echo ' - page № 3';
}
else if(preg_match ('/catalog\/(.*)\/\?PAGEN_1=4+/i', $_SERVER['REQUEST_URI'])) {
echo $APPLICATION->ShowTitle(); echo ' - page № 4';
}
else if(preg_match ('/catalog\/(.*)\/\?PAGEN_1=5+/i', $_SERVER['REQUEST_URI'])) {
echo $APPLICATION->ShowTitle(); echo ' - page № 5';
}
else if(preg_match ('/catalog\/(.*)\/\?PAGEN_1=6+/i', $_SERVER['REQUEST_URI'])) {
echo $APPLICATION->ShowTitle(); echo ' - page № 6';
}
else if(preg_match ('/catalog\/(.*)\/\?PAGEN_1=7+/i', $_SERVER['REQUEST_URI'])) {
echo $APPLICATION->ShowTitle(); echo ' - page № 7';
}
else if(preg_match ('/catalog\/(.*)\/\?PAGEN_1=8+/i', $_SERVER['REQUEST_URI'])) {
echo $APPLICATION->ShowTitle(); echo ' - page № 8';
}
else if(preg_match ('/catalog\/(.*)\/\?PAGEN_1=9+/i', $_SERVER['REQUEST_URI'])) {
echo $APPLICATION->ShowTitle(); echo ' - page № 9';
}
else if(preg_match ('/catalog\/(.*)\/\?PAGEN_1=10+/i', $_SERVER['REQUEST_URI'])) {
echo $APPLICATION->ShowTitle(); echo ' - page № 10';
}
else $APPLICATION->ShowTitle();
The same manual copy-paste is used here, but it is more clearly described.
Here is a way to automatically display the page number in the title:
$APPLICATION->ShowTitle(true); echo (preg_match('{.*?\?PAGEN_\d=(\d+)}', $_SERVER['REQUEST_URI'], $m) ? " – page ".$m[1] : '');
I draw your attention – this code needs to be tested, I do not remember where I used it.
Here is the detailed and quite beautiful code, with an additional condition for the news title:
<?
$t_add = (preg_match('{.*?\?PAGEN_\d=(\d+)}', $_SERVER['REQUEST_URI'], $m) ? " – page ".$m[1] : '');
$m_title = $APPLICATION->GetPageProperty('title');
if(!empty($m_title)){
echo '<title>'.$m_title.$t_add.'</title>';
}else{
?>
<title><?$APPLICATION->ShowTitle(); echo $t_add; ?> <?if (preg_match('#/news/\w#siU', $_SERVER['REQUEST_URI'])) echo " | News articles ";?> </title>
<?}?>
WEBinP Your guide to resolving CMS optimization, Web Development and SEO problems