如想屏蔽掉cms pages相关的单页面,首页在/app/code/core/Mage/Sitemap/Model这个路径下找到Sitemap.php,打开以后找到Generate cms pages sitemap(大概在171行左右)原文如下

/**

* 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) {
            $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>',
                htmlspecialchars($baseUrl . $item->getUrl()),
                $date,
                $changefreq,
                $priority
            );
            $io->streamWrite($xml);
        }
        unset($collection);

修改为:

        /**
         * 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) {
            $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>',
                htmlspecialchars($baseUrl . $item->getUrl()),
                $date,
                $changefreq,
                $priority
            );
            $io->streamWrite($xml);
        }
        unset($collection);
        */

       

也就是把这段给注释掉,这样就屏蔽掉那些单页面了

然后就是sitemap中没有首页,这个需要我们自己加上了,这个是我参考别人的,代码如下:

/**

* Generate index sitemap

*/

$xml= sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>daily</changefreq><priority>%.1f</priority></url>',

htmlspecialchars($baseUrl),

$date,

$changefreq,

$priority

);

$io->streamWrite($xml);



以上这段代码加在以下代码前就可以了:

   $io->streamWrite('</urlset>');
        $io->streamClose();

        $this->setSitemapTime(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
        $this->save();

        return $this;
    }
}