PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / presentations / indexable-static-posts-page-presentation.php

indexable-static-posts-page-presentation.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI trunk, at src/presentations/indexable-static-posts-page-presentation.php

51 lines 977 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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