You are here

function xmlsitemap_sitemap_uri in XML sitemap 2.x

Same name and namespace in other branches
  1. 8 xmlsitemap.module \xmlsitemap_sitemap_uri()
  2. 6.2 xmlsitemap.module \xmlsitemap_sitemap_uri()
  3. 7.2 xmlsitemap.module \xmlsitemap_sitemap_uri()

Returns the uri elements of an XML sitemap.


\Drupal\xmlsitemap\XmlSitemapInterface $sitemap: The sitemap represented by and XmlSitemapInterface object.

Return value

array An array containing the 'path' and 'options' keys used to build the uri of the XML sitemap, and matching the signature of url().

Related topics

3 calls to xmlsitemap_sitemap_uri()
XmlSitemapStorage::doLoadMultiple in src/XmlSitemapStorage.php
Performs storage-specific loading of entities.
XmlSitemapTestBase::drupalGetSitemap in tests/src/Functional/XmlSitemapTestBase.php
Retrieves an XML sitemap.
xmlsitemap_robotstxt in ./xmlsitemap.module
Implements hook_robotstxt().


./xmlsitemap.module, line 460
xmlsitemap XML sitemap


function xmlsitemap_sitemap_uri(XmlSitemapInterface $sitemap) {
  $uri['path'] = 'sitemap.xml';
  $uri['options'] = \Drupal::moduleHandler()
    ->invokeAll('xmlsitemap_context_url_options', [
  $context = $sitemap->context;
    ->alter('xmlsitemap_context_url_options', $uri['options'], $context);
  $uri['options'] += [
    'absolute' => TRUE,
    'base_url' => Settings::get('xmlsitemap_base_url', \Drupal::state()
  return $uri;