Commit 507ba278 authored by gbyte.co's avatar gbyte.co

Issue #2881469 by ziomizar: simple_sitemap.api.php documentation error

parent 6d69f2bf
...@@ -20,16 +20,18 @@ ...@@ -20,16 +20,18 @@
function hook_simple_sitemap_links_alter(&$links) { function hook_simple_sitemap_links_alter(&$links) {
// Remove German URL for a certain path in the hreflang sitemap. // Remove German URL for a certain path in the hreflang sitemap.
foreach ($links as &$link) { foreach ($links as $key => $link) {
if ($link['path'] == 'node/1') { if ($link['path'] == 'node/1') {
// Remove 'loc' URL if it points to a german site. // Remove 'loc' URL if it points to a german site.
if ($link['langcode'] == 'de') { if ($link['langcode'] == 'de') {
unset($link); unset($links[$key]);
} }
// If this 'loc' URL points to a non-german site, make sure to remove // If this 'loc' URL points to a non-german site, make sure to remove
// its german alternate URL. // its german alternate URL.
else { else {
unset($link['alternate_urls']['de']); if ($link['alternate_urls']['de']) {
unset($links[$key]['alternate_urls']['de']);
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment