You appear to be a bot. Output may be restricted
Description
Builds the sitemap.
Usage
$string = WPSEO_Sitemaps_Renderer::get_sitemap( $links, $type, $current_page );
Parameters
- $links
- ( array ) required – Set of sitemap links.
- $type
- ( string ) required – Sitemap type.
- $current_page
- ( int ) required – Current sitemap page number.
Returns
string
Source
File name: wordpress-seo/inc/sitemaps/class-sitemaps-renderer.php
Lines:
1 to 33 of 33
public function get_sitemap( $links, $type, $current_page ) { $urlset = '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" ' . 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd ' . 'http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd" ' . 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n"; /** * Filters the `urlset` for a sitemap by type. * * @api string $urlset The output for the sitemap's `urlset`. */ $xml = apply_filters( "wpseo_sitemap_{$type}_urlset", $urlset ); foreach ( $links as $url ) { $xml .= $this->sitemap_url( $url ); } /** * Filter to add extra URLs to the XML sitemap by type. * * Only runs for the first page, not on all. * * @param string $content String content to add, defaults to empty. */ if ( $current_page === 1 ) { $xml .= apply_filters( "wpseo_sitemap_{$type}_content", '' ); } $xml .= '</urlset>'; return $xml; }