Magento – How to put Meta Title Page

meta

i am trying to figure out the way to put my own Title on pages. I cannot find the field " meta tile"

I have browsed and it seems i have to put the code inside Design/Layout Update XML.
I found following code:

Your Module Page Title

Is " Your Module Page Title " should be the page title?

Hi hope hear from you soon
P.

Best Answer

As far as I understand, you like to set custom <title> in the CMS Pages. To do this you have to add new column in the database to store this info. The table is cms_page. Please add column meta_title similar to the title column. Then in app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Meta.php -> protected function _prepareForm() add this:

$fieldset->addField('meta_title', 'text', array(
    'name' => 'meta_title',
    'label' => Mage::helper('cms')->__('Title'),
    'title' => Mage::helper('cms')->__('Meta Title'),
    'disabled'  => $isElementDisabled
));

before $fieldset->addField('meta_keywords'. This way a new field Meta Title will be added in the admin panel -> CMS -> Pages -> tab Meta Data. To display it in <title> in app/code/core/Mage/Cms/Block/Page.php -> protected function _prepareLayout() replace this:

$head->setTitle($page->getTitle());

with this:

$head->setTitle($page->getMetaTitle() ? $page->getMetaTitle() : $page->getTitle());

So if there is filled Meta Title - it will be displayed otherwise the standard Title will be shown. That's it! Don't forget to flush the cache. And of course it's better to make an extension or at least copy the files in app/code/local not edit them directly.

Related Topic