fix
This commit is contained in:
@@ -79,17 +79,7 @@ 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";
|
|
||||||
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 ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$robots = ! empty( $page['indexable'] ) ? 'index, follow' : 'noindex, nofollow';
|
$robots = ! empty( $page['indexable'] ) ? 'index, follow' : 'noindex, nofollow';
|
||||||
printf( '<meta name="robots" content="%s">' . "\n", esc_attr( $robots ) );
|
printf( '<meta name="robots" content="%s">' . "\n", esc_attr( $robots ) );
|
||||||
|
|
||||||
@@ -105,17 +95,26 @@ function sev_tort_meta_tags() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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( '/' ) ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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,14 +280,7 @@ 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 ( is_front_page() ) {
|
if ( $page ) {
|
||||||
return sev_tort_home_seo_title();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! $page ) {
|
|
||||||
return $title;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( 'politika-konfidencialnosti' === $page['slug'] ) {
|
if ( 'politika-konfidencialnosti' === $page['slug'] ) {
|
||||||
return 'Политика в отношении обработки персональных данных';
|
return 'Политика в отношении обработки персональных данных';
|
||||||
}
|
}
|
||||||
@@ -289,6 +288,13 @@ function sev_tort_document_title( $title ) {
|
|||||||
return ! empty( $page['seo_title'] ) ? $page['seo_title'] : $page['title'];
|
return ! empty( $page['seo_title'] ) ? $page['seo_title'] : $page['title'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( is_front_page() ) {
|
||||||
|
return sev_tort_home_seo_title();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $title;
|
||||||
|
}
|
||||||
|
|
||||||
function sev_tort_home_seo_title() {
|
function sev_tort_home_seo_title() {
|
||||||
return 'Торты на заказ в Севастополе | Домашняя кондитерская';
|
return 'Торты на заказ в Севастополе | Домашняя кондитерская';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user