magento sitemap exclude

To exclude some webpages from sitemap (f.e. exclude your testing products, magento default “enable-cookie” and “update-browser” pages), you can exclude them in Sitempa.php what can be found here:


in public function generateXml() /* Generate cms pages sitemap */ foreach exclude what you need:

* Generate cms pages sitemap
$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) {
// here is your change
if ($item->getUrl() == 'enable-cookies') continue;
if ($item->getUrl() == 'update-browser') continue;
$xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>',
htmlspecialchars($baseUrl . $item->getUrl()),

In any case you should NOT do changes directly in core files, im showing this just to keep the solution simple as overwriting magento module is little more complicated.

Leave a Reply