Add SEO content in the magento footer

Add seo content in header

Do you know most of the search engines crawl from the bottom or footer of your pages?

The question is how can you add SEO friendly text in the footer of each and every page. It is easy regardless of whichever platform you are using.

Ok, let me explain how can you achieve this, it will definitely add a lot of value to your page ranking and conversion rate.

The first thing you need to do is identify the most unique pages of your website. In most of the e-commerce sites the main or unique pages are category, product and static or cms pages.

Once you have identified these pages, the next step would be to associate an attribute or a field with all these pages? If you are using Magento as your ecommerce platform then follow the steps below. Otherwise you got an idea how to achieve this, if you are still not sure, please comment on this post and we will be more than happy to help.

For Magento implementation, follow these steps -:

Create attribute for CMS pages -:

<?php 
$installer = $this;

$installer->startSetup();

$installer->run('
    ALTER TABLE '. $this->getTable("cms_page") . 
         ' ADD column seo_footer text NULL;
');

$installer->endSetup();
?>


Now to show the above attribute or field to the Meta tab of CMS pages, you need to use adminhtml_cms_page_edit_tab_meta_prepare_form event. Lets add the declaration of this event in our config.xml

<adminhtml>
    <events>
        <adminhtml_cms_page_edit_tab_meta_prepare_form>
            <observers>
                <scommerce_cms_page_edit_tab_meta>
                    <type>singleton</type>
                    <class>Scommerce_CMSAttributes_Model_Observer</class>
                    <method>createCMSFields</method>
                </scommerce_cms_page_edit_tab_meta>
            </observers>
        </adminhtml_cms_page_edit_tab_meta_prepare_form>
    </events>
</adminhtml>

Now the event has been declared in config.xml we need to create our createCMSFields function in Scommerce/CMSAttribures/Model/Observer.php file

public function createCMSFields($observer)
{
    $form = $observer->getEvent()->getForm();

    $fieldset = $form->getElement('meta_fieldset');

    $fieldset->addField('seo_footer', 'editor', array(
        'name' => 'seo_footer',
        'label' => Mage::helper('cms')->__('SEO footer text'),
        'title' => Mage::helper('cms')->__('SEO footer text'),
        'style'     => 'height:16em;',
        'wysiwyg'   => false,
        'disabled'  => 0
    ));
}

Now you should be able to see SEO footer text field in Meta tab (see below)

Ok, now you should be able to write unique SEO footer text for CMS pages, lets now do it for product and category pages.

For category and product pages it is much easier as you just need to create a sql set up file with the following content -:

<?php
$installer = $this;

$installer->startSetup();

$installer->addAttribute('catalog_category', 'seo_footer', array(
                        'type'              => 'text',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'SEO Footer',
                        'input'             => 'textarea',
                        'class'             => '',
                        'source'            => '',
                        'global'            => 0,
                        'visible'           => 1,
                        'required'          => 0,
                        'user_defined'      => 1,
                        'default'           => '',
                        'searchable'        => 0,
                        'filterable'        => 0,
                        'comparable'        => 0,
                        'visible_on_front'  => 0,
                        'unique'            => 0,
                        'position'          => 1,
                    ));

$installer->addAttribute('catalog_product', 'seo_footer', array(
                        'type'              => 'text',
                        'backend'           => '',
                        'frontend'          => '',
                        'label'             => 'SEO Footer',
                        'input'             => 'textarea',
                        'class'             => '',
                        'source'            => '',
                        'global'            => 0,
                        'visible'           => 1,
                        'required'          => 0,
                        'user_defined'      => 1,
                        'default'           => '',
                        'searchable'        => 0,
                        'filterable'        => 0,
                        'comparable'        => 0,
                        'visible_on_front'  => 0,
                        'unique'            => 0,
                        'position'          => 1,
                    ));                   
$installer->endSetup();

Until now we have the tool to add the content but we still need to show the content in the footer on the website. To show the content in the footer we need to add the following snippet.

<div id="seo">
  <?php 
   $routeName=Mage::app()->getFrontController()->getRequest()->getRouteName();
   $currentCategory = Mage::registry('current_category');
   $currentProduct = Mage::registry('current_product');
   if ($currentProduct):
    echo $currentProduct->getSeoFooter();
   elseif ($currentCategory):
    echo $currentCategory->getSeoFooter();
   elseif( $routeName == 'cms'):
    $page = Mage::getSingleton('cms/page');    
    echo $page->getSeoFooter();
  endif;
  ?>
</div>

That’s it! Hope you enjoyed this article and add value to your website!

20 thoughts on “Add SEO content in the magento footer

  1. Ive been meaning to read this and just never obtained a chance. Its an issue that Im really interested in, I just started reading and Im glad I did. Youre a excellent blogger, 1 of the very best that Ive seen. This weblog absolutely has some information and facts on topic that I just wasnt aware of. Thanks for bringing this things to light.

  2. I simply want to mention I actually enjoyed you’re web blog. Almost certainly I’m want to bookmark your blog . You surely come with terrific article content. Regards for sharing with us your website.

  3. Thanks, I believe your visitors could possibly want significantly more content articles similar to this carry on the excellent perform.

  4. Took me time for you to check out all the notes, but I truly enjoyed the article. It proved to be in fact helpful to me and I’m sure to all of the commenters right here! It’s usually great when you can not just be informed, but additionally engaged! I’m certain you had enjoyable writing this write-up.

  5. I simply want to tell you that I am all new to blogging and site-building and absolutely liked you’re page. Very likely I’m likely to bookmark your website . You surely come with great articles and reviews. Thank you for sharing with us your website page.

  6. An fascinating dialogue is worth comment. I believe that you should write more on this topic, it might not be a taboo topic but generally individuals are not sufficient to talk on such topics. To the next. Cheers

  7. Wonderful site. Plenty of useful info here. I’m sending it to a few pals ans additionally sharing in delicious. And naturally, thank you to your sweat!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.