Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

CMS Pages & SEO
 
Dan Orsborne
Member
 
Total Posts:  72
Joined:  2007-09-20
 

The page titles from the CMS Pages don’t get put on the actual pages when you view them. This can be fixed by changing the following:
app\code\core\Mage\Page\Block\Html\Head.php

public function toHtml()
    
{
        
//Start Edit
        
$_cmsTitle Mage::getSingleton('cms/page')->getTitle();
        if (
strlen($_cmsTitle)>0){
            $this
->addText('<title>'.$_cmsTitle.'</title>'."\n\t");
        
}else{
            $this
->addText('<title>'.$this->getTitle().'</title>'."\n\t");
        
}
        
//End Edit
        
$this->addText('<meta http-equiv="Content-Type" content="'.$this->getContentType().'"/>'."\n\t");
        
$this->addText('<meta name="description" content="'.$this->getDescription().'"/>'."\n\t");
        
$this->addText('<meta name="keywords" content="'.$this->getKeywords().'"/>'."\n\t");
        
$this->addText('<meta name="robots" content="'.$this->getRobots().'"/>'."\n");
        
$this->addText($this->getAdditionalCssJs());
        
$this->addText($this->getChildHtml());

        return 
parent::toHtml();
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
jmayer
Jr. Member
 
Total Posts:  21
Joined:  2007-09-03
 

Hi Dan,

This seems to throw an error on the 0.6.13700 build.
Any ideas here?

 
Magento Community Magento Community
Magento Community
Magento Community
 
jsperri
Sr. Member
 
Total Posts:  126
Joined:  2007-08-31
Fistufle
 

jmayer, which error do you get ? Can you paste it here ?

This patch works fine for me (ver 0.6.13700), and actually fix the title problem for CMS pages.
I hope Varien can include the patch in future release.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@jsperry: we’ll fix it a bit differently, so there won’t be dependency of Mage_Page from Mage_Cms.
In Mage_Cms_Helper_Page::renderPage will be added head title update:

// add this
        if ($head $action->getLayout()->getBlock('head')) {
            $head
->setTitle($page->getTitle());
        
}
// before
        
$action->renderLayout();

Note that home page and page not found will also have titles of the CMS pages.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top