You appear to be a bot. Output may be restricted
Description
Build and return the news sitemap xml. Note that the result of this function is cached in the transient 'jetpack_news_sitemap_xml'.
Usage
$string = Jetpack_Sitemap_Builder::news_sitemap_xml();
Parameters
Returns
string The news sitemap xml.
Source
File name: jetpack/modules/sitemaps/sitemap-builder.php
Lines:
1 to 53 of 53
public function news_sitemap_xml() { $the_stored_news_sitemap = get_transient( 'jetpack_news_sitemap_xml' ); if ( false === $the_stored_news_sitemap ) { if ( $this->logger ) { $this->logger->report( 'Beginning news sitemap generation.' ); } /** * Filter limit of entries to include in news sitemap. * * @module sitemaps * * @since 3.9.0 * * @param int $count Number of entries to include in news sitemap. */ $item_limit = apply_filters( 'jetpack_sitemap_news_sitemap_count', JP_NEWS_SITEMAP_MAX_ITEMS ); $buffer = new Jetpack_Sitemap_Buffer_News( min( $item_limit, JP_NEWS_SITEMAP_MAX_ITEMS ), JP_SITEMAP_MAX_BYTES ); $posts = $this->librarian->query_most_recent_posts( JP_NEWS_SITEMAP_MAX_ITEMS ); foreach ( $posts as $post ) { $current_item = $this->post_to_news_sitemap_item( $post ); if ( false === $buffer->append( $current_item['xml'] ) ) { break; } } if ( $this->logger ) { $this->logger->time( 'End news sitemap generation.' ); } $the_stored_news_sitemap = $buffer->contents(); set_transient( 'jetpack_news_sitemap_xml', $the_stored_news_sitemap, JP_NEWS_SITEMAP_INTERVAL ); } // End if. return $the_stored_news_sitemap; }