Yoast\WP\SEO\Presentations
Indexable_Post_Type_Presentation::generate_canonical() public Yoast 1.0
Generates the canonical.
{} Это метод класса: Indexable_Post_Type_Presentation{}
Хуков нет.
Возвращает
Строку. The canonical.
Использование
$Indexable_Post_Type_Presentation = new Indexable_Post_Type_Presentation(); $Indexable_Post_Type_Presentation->generate_canonical();
Код Indexable_Post_Type_Presentation::generate_canonical() Indexable Post Type Presentation::generate canonical Yoast 15.7
public function generate_canonical() {
if ( $this->model->canonical ) {
return $this->model->canonical;
}
$permalink = $this->get_permalink();
// Fix paginated pages canonical, but only if the page is truly paginated.
$current_page = $this->pagination->get_current_post_page_number();
if ( $current_page > 1 ) {
$number_of_pages = $this->model->number_of_pages;
if ( $number_of_pages && $current_page <= $number_of_pages ) {
$permalink = $this->get_paginated_url( $permalink, $current_page );
}
}
return $this->url->ensure_absolute_url( $permalink );
}