diff --git a/xmlsitemap.generate.inc b/xmlsitemap.generate.inc index 57c3bc1..1d1459d 100644 --- a/xmlsitemap.generate.inc +++ b/xmlsitemap.generate.inc @@ -232,7 +232,9 @@ function xmlsitemap_generate_chunk(stdClass $sitemap, XMLSitemapWriter $writer, // @todo Should this be moved to XMLSitemapWritier::writeSitemapElement()? drupal_alter('xmlsitemap_element', $element, $link, $sitemap); - $writer->writeSitemapElement('url', $element); + if (!empty($element)) { + $writer->writeSitemapElement('url', $element); + } } return $link_count;