Yoast\WP\SEO\Presentations
Indexable_Post_Type_Presentation::generate_robots
Generates the robots value.
Метод класса: Indexable_Post_Type_Presentation{}
Хуков нет.
Возвращает
Массив
. The robots value.
Использование
$Indexable_Post_Type_Presentation = new Indexable_Post_Type_Presentation(); $Indexable_Post_Type_Presentation->generate_robots();
Код Indexable_Post_Type_Presentation::generate_robots() Indexable Post Type Presentation::generate robots Yoast 25.3
public function generate_robots() { $robots = $this->get_base_robots(); $robots = \array_merge( $robots, [ 'imageindex' => ( $this->model->is_robots_noimageindex === true ) ? 'noimageindex' : null, 'archive' => ( $this->model->is_robots_noarchive === true ) ? 'noarchive' : null, 'snippet' => ( $this->model->is_robots_nosnippet === true ) ? 'nosnippet' : null, ] ); // No snippet means max snippet can be omitted. if ( $this->model->is_robots_nosnippet === true ) { $robots['max-snippet'] = null; } // No image index means max image preview can be omitted. if ( $this->model->is_robots_noimageindex === true ) { $robots['max-image-preview'] = null; } // When the post specific index is not set, look to the post status and default of the post type. if ( $this->model->is_robots_noindex === null ) { $post_status_private = \get_post_status( $this->model->object_id ) === 'private'; $post_type_noindex = ! $this->post_type->is_indexable( $this->model->object_sub_type ); if ( $post_status_private || $post_type_noindex ) { $robots['index'] = 'noindex'; } } return $this->filter_robots( $robots ); }