Yoast\WP\SEO\Presentations

Indexable_Post_Type_Archive_Presentation::generate_canonical()publicYoast 1.0

Generates the canonical.

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

Хуков нет.

Возвращает

Строку. The canonical.

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

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

Код Indexable_Post_Type_Archive_Presentation::generate_canonical() Yoast 20.0

public function generate_canonical() {
	$permalink = $this->permalink;
	if ( ! $permalink ) {
		return '';
	}

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

	return $permalink;
}