Yoast\WP\SEO\Llms_Txt\Infrastructure\Markdown_Services

Sitemap_Link_Collector{}Yoast 1.0

The sitemap link collector.

Хуков нет.

Использование

$Sitemap_Link_Collector = new Sitemap_Link_Collector();
// use class methods

Методы

  1. public get_link()

Код Sitemap_Link_Collector{} Yoast 27.7

class Sitemap_Link_Collector {

	/**
	 * Gets the link for the sitemap.
	 *
	 * @return Link The link for the sitemap.
	 */
	public function get_link(): ?Link {
		if ( WPSEO_Options::get( 'enable_xml_sitemap' ) ) {
			$sitemap_url = WPSEO_Sitemaps_Router::get_base_url( 'sitemap_index.xml' );
			return new Link( 'Sitemap index', $sitemap_url );
		}

		$sitemap_url = \get_sitemap_url( 'index' );

		if ( $sitemap_url !== false ) {
			return new Link( 'Sitemap index', $sitemap_url );
		}

		return null;
	}
}