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