SwissUpLabs Logo

Adding extension links to sitemap

Other extensions can add their links to sitemap using tm_seohtmlsitemap_prepare_custom_links event. Here is example how its done in Highlight extension:

  1. add event listener in config.xml in frontend section:

  2. create observer in Model/Observer.php:

    class TM_Highlight_Model_Observer
         * Add Highlight links to HTML Sitemap
         * @param Varien_Event_Observer $observer
         * @return TM_Highlight_Model_Observer
        public function addLinks($observer)
            $links = $observer->getLinks();
            $pages = Mage::helper('highlight')->getPages();
            return $this;
  3. in helper you can add module specific code to get links array:

    public function getPages()
        $pages = array();
        // module specific code to get pages
        return $pages;

    It should generate array in the following format:

        [link_1] => array(
            [name] => Link Text,
            [url] => Link URL
        [link_2] => array(
            [name] => Link Text,
            [url] => Link URL
Next Up
Edit this Page