PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.7
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.7
28.6 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 All 130 releases
wordpress-seo / src / llms-txt / infrastructure / markdown-services / sitemap-link-collector.php

sitemap-link-collector.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 27.7, at src/llms-txt/infrastructure/markdown-services/sitemap-link-collector.php

35 lines 787 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
4 namespace Yoast\WP\SEO\Llms_Txt\Infrastructure\Markdown_Services;
5
6 use WPSEO_Options;
7 use WPSEO_Sitemaps_Router;
8 use Yoast\WP\SEO\Llms_Txt\Domain\Markdown\Items\Link;
9
10 /**
11 * The sitemap link collector.
12 */
13 class Sitemap_Link_Collector {
14
15 /**
16 * Gets the link for the sitemap.
17 *
18 * @return Link The link for the sitemap.
19 */
20 public function get_link(): ?Link {
21 if ( WPSEO_Options::get( 'enable_xml_sitemap' ) ) {
22 $sitemap_url = WPSEO_Sitemaps_Router::get_base_url( 'sitemap_index.xml' );
23 return new Link( 'Sitemap index', $sitemap_url );
24 }
25
26 $sitemap_url = \get_sitemap_url( 'index' );
27
28 if ( $sitemap_url !== false ) {
29 return new Link( 'Sitemap index', $sitemap_url );
30 }
31
32 return null;
33 }
34 }
35