• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Yoast SEO a2z

Yoast SEO a2z

WordPress SEO a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / WPSEO_Sitemaps_Renderer::get_sitemap() – Builds the sitemap.

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;
  }
 

 View on GitHub View on Trac

Published: 27th November 2019 | Last updated: 27th November 2019

Primary Sidebar

Information

Function name: WPSEO_Sitemaps_Renderer::get_sitemap
Class ref: WPSEO_Sitemaps_Renderer
Plugin ref: Yoast SEO
Version: 15.4
Sourcefile: inc/sitemaps/class-sitemaps-renderer.php
File ref: inc/sitemaps/class-sitemaps-renderer.php
Deprecated?: No
API Letters: G,R,S,W

Footer

Yoast SEO a2z
Yoast SEO a2z
WordPress SEO a2z
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wordpress-seo.wp-a2z.org
© Copyright Yoast SEO a2z 2017-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites