Magento Custom Module SEO – Adding Meta Tags

seo

Here, I put a custom magento "Storelocator" module, however I noticed that the tags "meta" was already preset in the source code of the page.

I just wanted that on this page there are other independent meta tag.
head.phtml and the default file.

I surfed the web to find a solution is I stumbled upon this page :
https://stackoverflow.com/questions/24373670/how-to-rewrite-head-phtml-in-magento

For cons, I want to put meta tags directly into the page storelocator.phtml.

So how to disable the Head.phtml in Storelocator page?

Thank you for your help.

Best Answer

This is not an answer to your question, but it may be a solution to your problem.
You don't need to disable the head.phtml in your custom module pages. There might be useful information in there that you would want in your pages.
In order to change the meta data you can do this.

If the meta values are always the same you can use the layout xml.

<page_handle_here><!-- your page handle module_controller_action -->
    <reference name="head">
        <action method="setTitle" translate="title"><title>Your meta title here</title></action>
        <action method="setKeywords" translate="keywords"><keywords>Your meta keywords here</keywords></action>
        <action method="setDescription" translate="description"><description>Your meta description here</description></action>
    </reference>
</page_handle_here>

If your values are dynamic you can use this in the action of your page after calling loadLayout

$head = $this->getLayout()->getBlock('head');
if ($head) {
    $head->setTitle('your title here');
    $head->setDescription('your description here');
    $head->setKeywords('your keywords here');
}
Related Topic