From 8f4b205e5d7389155ec7aac9e05a6952af2c0e6a Mon Sep 17 00:00:00 2001 From: Jeremy Date: Fri, 8 Aug 2025 10:59:22 -0400 Subject: [PATCH] Update SitemapGenerator.php The addURL function has been updated to allow for the host and page path to be added simultaneously, which is consistent with the functionality in versions prior to 4.7.0. --- src/SitemapGenerator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SitemapGenerator.php b/src/SitemapGenerator.php index 3de1b1d..0c4bd08 100644 --- a/src/SitemapGenerator.php +++ b/src/SitemapGenerator.php @@ -435,7 +435,9 @@ public function addURL( $this->writeSitemapStart(); } - $this->writeSitemapUrl($this->baseURL . $path, $lastModified, $changeFrequency, $priority, $alternates, $extensions); + $link = preg_match('/^https?:\/\//i', trim($path)) ? $path : $this->baseURL . $path; + + $this->writeSitemapUrl($link, $lastModified, $changeFrequency, $priority, $alternates, $extensions); if ($this->totalURLCount % 1000 === 0 || $this->sitemapURLCount >= $this->maxURLsPerSitemap) { $this->flushWriter();