Loading src/Plugin/simple_sitemap/SitemapGenerator/DefaultSitemapGenerator.php +3 −5 Original line number Diff line number Diff line Loading @@ -81,7 +81,9 @@ class DefaultSitemapGenerator extends SitemapGeneratorBase { * The array of properties for this URL. */ protected function addUrl(array $url_data): void { if (isset($url_data['url'])) { $this->writer->writeElement('loc', $url_data['url']); } // If more than one language is enabled, add all translation variant URLs // as alternate links to this link turning the sitemap into a hreflang Loading @@ -90,22 +92,18 @@ class DefaultSitemapGenerator extends SitemapGeneratorBase { $this->addAlternateUrls($url_data['alternate_urls']); } // Add lastmod if any. if (isset($url_data['lastmod'])) { $this->writer->writeElement('lastmod', $url_data['lastmod']); } // Add changefreq if any. if (isset($url_data['changefreq'])) { $this->writer->writeElement('changefreq', $url_data['changefreq']); } // Add priority if any. if (isset($url_data['priority'])) { $this->writer->writeElement('priority', $url_data['priority']); } // Add images if any. if (!empty($url_data['images'])) { foreach ($url_data['images'] as $image) { $this->writer->startElement('image:image'); Loading src/Plugin/simple_sitemap/SitemapGenerator/SitemapIndexGenerator.php +9 −2 Original line number Diff line number Diff line Loading @@ -46,8 +46,15 @@ class SitemapIndexGenerator extends DefaultSitemapGenerator { protected function addLinks(array $links): void { foreach ($links as $url_data) { $this->writer->startElement('sitemap'); $this->writer->writeElement('loc', $url_data['loc']); if (isset($url_data['url'])) { $this->writer->writeElement('loc', $url_data['url']); } if (isset($url_data['lastmod'])) { $this->writer->writeElement('lastmod', $url_data['lastmod']); } $this->writer->endElement(); } } Loading src/Plugin/simple_sitemap/UrlGenerator/SitemapIndexUrlGenerator.php +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ class SitemapIndexUrlGenerator extends UrlGeneratorBase { $url_object = $sitemap->toUrl()->setAbsolute(); return [ 'loc' => $url_object->toString(), 'url' => $url_object->toString(), 'lastmod' => date('c', $sitemap->fromPublished()->getCreated()), // Additional info useful in hooks. Loading src/Plugin/simple_sitemap/UrlGenerator/UrlGeneratorBase.php +0 −2 Original line number Diff line number Diff line Loading @@ -2,8 +2,6 @@ namespace Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator; use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Url; use Drupal\simple_sitemap\Exception\SkipElementException; use Drupal\simple_sitemap\Plugin\simple_sitemap\SimpleSitemapPluginBase; use Drupal\simple_sitemap\Entity\SimpleSitemapInterface; Loading Loading
src/Plugin/simple_sitemap/SitemapGenerator/DefaultSitemapGenerator.php +3 −5 Original line number Diff line number Diff line Loading @@ -81,7 +81,9 @@ class DefaultSitemapGenerator extends SitemapGeneratorBase { * The array of properties for this URL. */ protected function addUrl(array $url_data): void { if (isset($url_data['url'])) { $this->writer->writeElement('loc', $url_data['url']); } // If more than one language is enabled, add all translation variant URLs // as alternate links to this link turning the sitemap into a hreflang Loading @@ -90,22 +92,18 @@ class DefaultSitemapGenerator extends SitemapGeneratorBase { $this->addAlternateUrls($url_data['alternate_urls']); } // Add lastmod if any. if (isset($url_data['lastmod'])) { $this->writer->writeElement('lastmod', $url_data['lastmod']); } // Add changefreq if any. if (isset($url_data['changefreq'])) { $this->writer->writeElement('changefreq', $url_data['changefreq']); } // Add priority if any. if (isset($url_data['priority'])) { $this->writer->writeElement('priority', $url_data['priority']); } // Add images if any. if (!empty($url_data['images'])) { foreach ($url_data['images'] as $image) { $this->writer->startElement('image:image'); Loading
src/Plugin/simple_sitemap/SitemapGenerator/SitemapIndexGenerator.php +9 −2 Original line number Diff line number Diff line Loading @@ -46,8 +46,15 @@ class SitemapIndexGenerator extends DefaultSitemapGenerator { protected function addLinks(array $links): void { foreach ($links as $url_data) { $this->writer->startElement('sitemap'); $this->writer->writeElement('loc', $url_data['loc']); if (isset($url_data['url'])) { $this->writer->writeElement('loc', $url_data['url']); } if (isset($url_data['lastmod'])) { $this->writer->writeElement('lastmod', $url_data['lastmod']); } $this->writer->endElement(); } } Loading
src/Plugin/simple_sitemap/UrlGenerator/SitemapIndexUrlGenerator.php +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ class SitemapIndexUrlGenerator extends UrlGeneratorBase { $url_object = $sitemap->toUrl()->setAbsolute(); return [ 'loc' => $url_object->toString(), 'url' => $url_object->toString(), 'lastmod' => date('c', $sitemap->fromPublished()->getCreated()), // Additional info useful in hooks. Loading
src/Plugin/simple_sitemap/UrlGenerator/UrlGeneratorBase.php +0 −2 Original line number Diff line number Diff line Loading @@ -2,8 +2,6 @@ namespace Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator; use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Url; use Drupal\simple_sitemap\Exception\SkipElementException; use Drupal\simple_sitemap\Plugin\simple_sitemap\SimpleSitemapPluginBase; use Drupal\simple_sitemap\Entity\SimpleSitemapInterface; Loading