This commit is contained in:
2026-07-05 13:32:44 +03:00
parent 9af8feaf3b
commit 1478ff48ae

View File

@@ -79,43 +79,42 @@ add_action( 'wp_head', 'sev_tort_meta_tags', 1 );
function sev_tort_meta_tags() {
$page = sev_tort_current_page_config();
if ( is_front_page() ) {
echo '<meta name="robots" content="index, follow">' . "\n";
printf( '<meta name="description" content="%s">' . "\n", esc_attr( sev_tort_home_seo_description() ) );
printf( '<link rel="canonical" href="%s">' . "\n", esc_url( home_url( '/' ) ) );
return;
}
if ( $page ) {
$robots = ! empty( $page['indexable'] ) ? 'index, follow' : 'noindex, nofollow';
printf( '<meta name="robots" content="%s">' . "\n", esc_attr( $robots ) );
if ( ! $page ) {
return;
}
if ( 'politika-konfidencialnosti' === $page['slug'] ) {
printf( '<meta name="description" content="%s">' . "\n", esc_attr( 'Политика в отношении обработки персональных данных посетителей сайта sevastopol-tort.ru.' ) );
printf( '<link rel="canonical" href="%s">' . "\n", esc_url( home_url( '/' . $page['slug'] . '/' ) ) );
return;
}
$robots = ! empty( $page['indexable'] ) ? 'index, follow' : 'noindex, nofollow';
printf( '<meta name="robots" content="%s">' . "\n", esc_attr( $robots ) );
if ( ! empty( $page['description'] ) ) {
$description = ! empty( $page['seo_description'] ) ? $page['seo_description'] : $page['description'];
printf( '<meta name="description" content="%s">' . "\n", esc_attr( $description ) );
}
if ( 'politika-konfidencialnosti' === $page['slug'] ) {
printf( '<meta name="description" content="%s">' . "\n", esc_attr( 'Политика в отношении обработки персональных данных посетителей сайта sevastopol-tort.ru.' ) );
printf( '<link rel="canonical" href="%s">' . "\n", esc_url( home_url( '/' . $page['slug'] . '/' ) ) );
return;
}
if ( ! empty( $page['description'] ) ) {
$description = ! empty( $page['seo_description'] ) ? $page['seo_description'] : $page['description'];
printf( '<meta name="description" content="%s">' . "\n", esc_attr( $description ) );
if ( is_front_page() ) {
echo '<meta name="robots" content="index, follow">' . "\n";
printf( '<meta name="description" content="%s">' . "\n", esc_attr( sev_tort_home_seo_description() ) );
printf( '<link rel="canonical" href="%s">' . "\n", esc_url( home_url( '/' ) ) );
}
printf( '<link rel="canonical" href="%s">' . "\n", esc_url( home_url( '/' . $page['slug'] . '/' ) ) );
}
add_filter( 'wp_robots', 'sev_tort_wp_robots', 100 );
function sev_tort_wp_robots( $robots ) {
$page = sev_tort_current_page_config();
if ( is_front_page() || ( $page && ! empty( $page['indexable'] ) ) ) {
if ( $page && ! empty( $page['indexable'] ) ) {
unset( $robots['noindex'], $robots['nofollow'] );
$robots['index'] = true;
$robots['follow'] = true;
$robots['max-image-preview'] = 'large';
return $robots;
}
if ( $page && 'politika-konfidencialnosti' === $page['slug'] ) {
@@ -124,6 +123,13 @@ function sev_tort_wp_robots( $robots ) {
$robots['nofollow'] = true;
}
if ( ! $page && is_front_page() ) {
unset( $robots['noindex'], $robots['nofollow'] );
$robots['index'] = true;
$robots['follow'] = true;
$robots['max-image-preview'] = 'large';
}
return $robots;
}
@@ -164,7 +170,7 @@ function sev_tort_schema_markup() {
'inLanguage' => 'ru-RU',
);
if ( is_front_page() ) {
if ( ! $page && is_front_page() ) {
$schema[] = sev_tort_faq_schema(
array(
array(
@@ -274,19 +280,19 @@ add_filter( 'pre_get_document_title', 'sev_tort_document_title' );
function sev_tort_document_title( $title ) {
$page = sev_tort_current_page_config();
if ( $page ) {
if ( 'politika-konfidencialnosti' === $page['slug'] ) {
return 'Политика в отношении обработки персональных данных';
}
return ! empty( $page['seo_title'] ) ? $page['seo_title'] : $page['title'];
}
if ( is_front_page() ) {
return sev_tort_home_seo_title();
}
if ( ! $page ) {
return $title;
}
if ( 'politika-konfidencialnosti' === $page['slug'] ) {
return 'Политика в отношении обработки персональных данных';
}
return ! empty( $page['seo_title'] ) ? $page['seo_title'] : $page['title'];
return $title;
}
function sev_tort_home_seo_title() {