PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 19.0
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v19.0
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 19.0, at src/presentations/indexable-static-posts-page-presentation.php

52 lines 1013 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 $permalink = $this->get_permalink();
35
36 if ( $current_page > 1 ) {
37 return $this->pagination->get_paginated_url( $permalink, $current_page );
38 }
39
40 return $permalink;
41 }
42
43 /**
44 * Generates the Open Graph URL.
45 *
46 * @return string The Open Graph URL.
47 */
48 public function generate_open_graph_url() {
49 return $this->get_permalink();
50 }
51 }
52