Magento 1.9.0.0. added two events to adjust product and category XML sitemap:
sitemap_categories_generating_before
sitemap_products_generating_before
In Mage_Sitemap_Model_Sitemap::generateXml()
they replaced
foreach ($collection as $item) {
with
$priority = (string)Mage::getStoreConfig('sitemap/product/priority', $storeId);
$collection = Mage::getResourceModel('sitemap/catalog_product')->getCollection($storeId);
$products = new Varien_Object();
$products->setItems($collection);
Mage::dispatchEvent('sitemap_products_generating_before', array(
'collection' => $products
));
foreach ($products->getItems() as $item) {
Same for category pages, but 20 lines below they just kept foreach ($collection as $item)
for CMS pages. I'd would adapt this method and rewrite/modify Mage_Sitemap_Model_Sitemap
to replace it with ...
$pages = new Varien_Object();
$pages->setItems($collection);
Mage::dispatchEvent('sitemap_cms_pages_generating_before', array(
'collection' => $pages,
'store_id' => $storeId
));
foreach ($pages->getItems() as $item) {
Then you can use that new event to modify your CMS pages sitemap:
Event:
<sitemap_cms_pages_generating_before>
<observers>
<rename_home>
<class>[model]/observer</class>
<method>renameCmsHomePageUrl</method>
</rename_home>
</observers>
</sitemap_cms_pages_generating_before>
Observer:
public function renameCmsHomePageUrl(Varien_Event_Observer $observer)
{
$collection = $observer->getCollection();
foreach ($collection->getItems() as $item) {
if ($item->getUrl() === 'home') {
$item->setUrl('');
break;
}
}
}