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

How do I add shop description to <title>? 
 
Mateusz Papiernik
Member
 
Total Posts:  33
Joined:  2008-01-04
 

Hey,

Is there any easy way to add shop decription into <title> of every single rendered page? Catalog features shop name in the title tag (but it can’t be long, when I tried to add descriptive text as a name in admin panel, it was cut after half), static pages don’t insert anything in <title>.

Thanks,
M.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Serge at Varien
Magento Team
 
Avatar
Total Posts:  73
Joined:  2008-01-18
 

Hello Mateusz!

the easiest way to do it at the moment is just to go to /app/code/core/Mage/Page/Block/Html/Head.php, look for the next function there:

public function toHtml()
    
{
        $this
->addText('<title>'.$this->getTitle().'</title>'."\n\t");
        
$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();
    
}

and replace the next string:

$this->addText('<title>'.$this->getTitle().'</title>'."\n\t");

by something like:

$this->addText('<title>Your Shop Name - '.$this->getTitle().'</title>'."\n\t");

this solution is the fastest one, but it isn’t elegant and probably in the next release you will find this function modified and the whole title/meta part will be moved to the /app/design/frontend/default/default/template/page/html/head.phtml template, so you will need to make similar alterations there.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mateusz Papiernik
Member
 
Total Posts:  33
Joined:  2008-01-04
 

Well, thanks! I thought maybe it could be done without touching the core modules - I will do it that way then. Thanks for your time and pointing the right file, one search through magento files less wink)))

Best Regards!
Mateusz

 
Magento Community Magento Community
Magento Community
Magento Community
 
Serge at Varien
Magento Team
 
Avatar
Total Posts:  73
Joined:  2008-01-18
 

Hello Mateusz!

actually you are able to don’t touch core modules and just create your local module in app/code/local that will inherit original one and just rewrite a single method there…

Best regards,
Serge

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