Yoast\WP\SEO\Presentations

Indexable_Static_Posts_Page_Presentation::generate_canonical()publicYoast 1.0

Generates the canonical.

Метод класса: Indexable_Static_Posts_Page_Presentation{}

Хуков нет.

Возвращает

Строку. The canonical.

Использование

$Indexable_Static_Posts_Page_Presentation = new Indexable_Static_Posts_Page_Presentation();
$Indexable_Static_Posts_Page_Presentation->generate_canonical();

Код Indexable_Static_Posts_Page_Presentation::generate_canonical() Yoast 20.0

public function generate_canonical() {
	if ( $this->model->canonical ) {
		return $this->model->canonical;
	}

	$current_page = $this->pagination->get_current_archive_page_number();

	if ( $current_page > 1 ) {
		return $this->pagination->get_paginated_url( $this->permalink, $current_page );
	}

	return $this->permalink;
}