| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Presentations; |
| 4 |
|
| 5 |
/** |
| 6 |
* Class Indexable_Home_Page_Presentation. |
| 7 |
* |
| 8 |
* Presentation object for indexables. |
| 9 |
*/ |
| 10 |
class Indexable_Home_Page_Presentation extends Indexable_Presentation { |
| 11 |
|
| 12 |
use Archive_Adjacent; |
| 13 |
|
| 14 |
/** |
| 15 |
* Generates the canonical. |
| 16 |
* |
| 17 |
* @return string The canonical. |
| 18 |
*/ |
| 19 |
public function generate_canonical() { |
| 20 |
if ( $this->model->canonical ) { |
| 21 |
return $this->model->canonical; |
| 22 |
} |
| 23 |
|
| 24 |
$permalink = $this->get_permalink(); |
| 25 |
|
| 26 |
if ( ! $permalink ) { |
| 27 |
return ''; |
| 28 |
} |
| 29 |
|
| 30 |
$current_page = $this->pagination->get_current_archive_page_number(); |
| 31 |
if ( $current_page > 1 ) { |
| 32 |
return $this->pagination->get_paginated_url( $permalink, $current_page ); |
| 33 |
} |
| 34 |
|
| 35 |
return $permalink; |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Generates the meta description. |
| 40 |
* |
| 41 |
* @return string The meta description. |
| 42 |
*/ |
| 43 |
public function generate_meta_description() { |
| 44 |
if ( $this->model->description ) { |
| 45 |
return $this->model->description; |
| 46 |
} |
| 47 |
|
| 48 |
return $this->options->get( 'metadesc-home-wpseo' ); |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Generates the title. |
| 53 |
* |
| 54 |
* @return string The title. |
| 55 |
*/ |
| 56 |
public function generate_title() { |
| 57 |
if ( $this->model->title ) { |
| 58 |
return $this->model->title; |
| 59 |
} |
| 60 |
|
| 61 |
return $this->options->get_title_default( 'title-home-wpseo' ); |
| 62 |
} |
| 63 |
} |
| 64 |
|