| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Presentations; |
| 4 |
|
| 5 |
use Yoast\WP\SEO\Helpers\Pagination_Helper; |
| 6 |
|
| 7 |
/** |
| 8 |
* Class Indexable_Static_Posts_Page_Presentation. |
| 9 |
* |
| 10 |
* Presentation object for indexables. |
| 11 |
*/ |
| 12 |
class Indexable_Static_Posts_Page_Presentation extends Indexable_Post_Type_Presentation { |
| 13 |
|
| 14 |
use Archive_Adjacent; |
| 15 |
|
| 16 |
/** |
| 17 |
* The pagination helper. |
| 18 |
* |
| 19 |
* @var Pagination_Helper |
| 20 |
*/ |
| 21 |
protected $pagination; |
| 22 |
|
| 23 |
/** |
| 24 |
* Generates the canonical. |
| 25 |
* |
| 26 |
* @return string The canonical. |
| 27 |
*/ |
| 28 |
public function generate_canonical() { |
| 29 |
if ( $this->model->canonical ) { |
| 30 |
return $this->model->canonical; |
| 31 |
} |
| 32 |
|
| 33 |
$current_page = $this->pagination->get_current_archive_page_number(); |
| 34 |
|
| 35 |
if ( $current_page > 1 ) { |
| 36 |
return $this->pagination->get_paginated_url( $this->permalink, $current_page ); |
| 37 |
} |
| 38 |
|
| 39 |
return $this->permalink; |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* Generates the Open Graph URL. |
| 44 |
* |
| 45 |
* @return string The Open Graph URL. |
| 46 |
*/ |
| 47 |
public function generate_open_graph_url() { |
| 48 |
return $this->permalink; |
| 49 |
} |
| 50 |
} |
| 51 |
|