Yoast\WP\SEO\Presentations
Indexable_Term_Archive_Presentation::generate_robots
Generates the robots value.
Метод класса: Indexable_Term_Archive_Presentation{}
Хуков нет.
Возвращает
Массив. The robots value.
Использование
$Indexable_Term_Archive_Presentation = new Indexable_Term_Archive_Presentation(); $Indexable_Term_Archive_Presentation->generate_robots();
Код Indexable_Term_Archive_Presentation::generate_robots() Indexable Term Archive Presentation::generate robots Yoast 27.4
public function generate_robots() {
$robots = $this->get_base_robots();
/**
* If its a multiple terms archive page return a noindex.
*/
if ( $this->current_page->is_multiple_terms_page() ) {
$robots['index'] = 'noindex';
return $this->filter_robots( $robots );
}
/**
* First we get the no index option for this taxonomy, because it can be overwritten the indexable value for
* this specific term.
*/
if ( \is_wp_error( $this->source ) || ! $this->taxonomy->is_indexable( $this->source->taxonomy ) ) {
$robots['index'] = 'noindex';
}
/**
* Overwrite the index directive when there is a term specific directive set.
*/
if ( $this->model->is_robots_noindex !== null ) {
$robots['index'] = ( $this->model->is_robots_noindex ) ? 'noindex' : 'index';
}
return $this->filter_robots( $robots );
}