You are here

function hook_xmlsitemap_root_attributes_alter in XML sitemap 7.2

Same name and namespace in other branches
  1. 8 xmlsitemap.api.php \hook_xmlsitemap_root_attributes_alter()
  2. 2.x xmlsitemap.api.php \hook_xmlsitemap_root_attributes_alter()

Alter the attributes used for the root element of the XML sitemap.

For example add an xmlns:video attribute:


<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:video="https://www.google.com/schemas/sitemap-video/1.1">

Parameters

array $attributes: An associative array of attributes to use in the root element of an XML sitemap.

object $sitemap: The sitemap that is currently being generated.

2 invocations of hook_xmlsitemap_root_attributes_alter()
XMLSitemapIndexWriter::getRootAttributes in ./xmlsitemap.xmlsitemap.inc
Get Root Attributes.
XMLSitemapWriter::getRootAttributes in ./xmlsitemap.xmlsitemap.inc
Return an array of attributes for the root element of the XML.

File

./xmlsitemap.api.php, line 269
Hooks provided by the XML sitemap module.

Code

function hook_xmlsitemap_root_attributes_alter(array &$attributes, $sitemap) {
  $attributes['xmlns:video'] = 'https://www.google.com/schemas/sitemap-video/1.1';
}