Last active
November 12, 2020 21:03
-
-
Save Edarlingen/6517b2572b73867e5b2d to your computer and use it in GitHub Desktop.
Установка H1 в NetCat
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
<?php | |
function get_seo_h1() { | |
global $current_sub; | |
global $current_cc; | |
global $action; | |
global $message; | |
$nc_core = nc_Core::get_object(); | |
// По умолчанию даем NetCat определить значение | |
$seo_h1 = $nc_core->page->get_h1(); | |
// Текущий раздел, на странице объекта | |
if ($action === 'full') { | |
// Cобираем информацию о текущем объекте | |
$current_object = $nc_core->message->get_by_id($current_cc['Class_ID'], $message); | |
// Ищем информацию для формирования H1 в полях H1, Name, PageTitle и Title компонента, если такие есть | |
if ($current_object['H1']) { | |
return $current_object['H1']; | |
} | |
if ($current_object['Name']) { | |
return $current_object['Name']; | |
} | |
if ($current_object['PageTitle']) { | |
return $current_object['PageTitle']; | |
} | |
if ($current_object['Title']) { | |
return $current_object['Title']; | |
} | |
if ($current_object['textTitle']) { | |
return $current_object['textTitle']; | |
} | |
} | |
return $seo_h1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment