Skip to content

Commit

Permalink
[impr-OpenMage#101] Only use base url for homepage in generated sitem…
Browse files Browse the repository at this point in the history
…ap.xml

tja. works for 99% is important to have right for 100%. But this solution is not sound proof.
Still I would advise to accept it. As de base-url is always the homepage ... and I am not sure
we would want to create another config option with "use baseurl als main homepage yes/no"
  • Loading branch information
shirtsofholl authored and edannenberg committed Aug 17, 2020
1 parent 93e5de2 commit fa6f377
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/code/core/Mage/Sitemap/Model/Sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,16 @@ public function generateXml()
/**
* Generate cms pages sitemap
*/
$homepage = (string)Mage::getStoreConfig('web/default/cms_home_page', $storeId);
$changefreq = (string)Mage::getStoreConfig('sitemap/page/changefreq', $storeId);
$priority = (string)Mage::getStoreConfig('sitemap/page/priority', $storeId);
$collection = Mage::getResourceModel('sitemap/cms_page')->getCollection($storeId);
foreach ($collection as $item) {
$url = $item->getUrl();
if ( $url == $homepage) { $url = ''; }
$xml = sprintf(
'<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>',
htmlspecialchars($baseUrl . $item->getUrl()),
htmlspecialchars($baseUrl . $url),
$date,
$changefreq,
$priority
Expand Down

0 comments on commit fa6f377

Please sign in to comment.