SEO – Why is Start Page Missing from Sitemap.xml?

cms-pagesseositemaps

I'm rather new on the Magento platform, but I've noticed a weird thing on a couple of my clients' websites. The home page is missing from the sitemap.xml.

In all cases the clients' home page is a CMS page and the CMS page has a URL key that is "home". Off course, the page www.client.com/home exists as a page and in the sitemap, but I am missing www.client.com in the sitemap.

This is really frustrating since I want to submit an as accurate as possible sitemap.xml to Google and Bing. Does anyone have a solution for this?

Best Answer

The reason for this behavior is found in the function Mage_Sitemap_Model_Sitemap::generateXml. Here magento loops through the categories, products and cms pages and creates the xml nodes for each item. As you noted in your question the /home entry exists as this is covered by the cms pages.

There are events for manipulating the category and product collections specifically for the sitemap but sadly there are none for the cms pages. I would suggest the following, either:

  1. Rewrite Mage_Sitemap_Model_Sitemap and add your own checks/fire a cms event after the collection is loaded,
  2. Listen to the collection load after event and check to make sure, the collection is the cms page collection and your request comes from the generation of sitemaps,

With either of these options you should be able to update the value of the url when dealing with the home page to be the website's home url and not the cms page url_key.