1. Home
  2. Prices
  3. Guided Tour
  4. New Shop
  5. Shop Review
  6. Ecommerce Marketing
  7. Ecommerce TV
  8. Magento Developers
  9. Portfolio
  10. Blog
  11. Contact
Home > Magento, Magento Tutorials > Magento – SEO Meta Data

Magento – SEO Meta Data

Posted on: 27th Nov 2009 By: Adam Moss Leave a comment No Comments

By default, Magento will display the default meta keywords and meta description on every page, something which is defined in the Configuration of the Magento store. Meta descriptions are vital in the performance of a site’s keywords, and it is believed on good grounds that duplicate meta descriptions throughout a site will be detrimental to its success. It’s better for an un-optimised page to have no description, rather than share the same description with 100s of other pages on the site.

The solution is a simple hack in the head.phtml file (app/design/frontend/default/yourtheme/template/page/html/head.phtml).

Paste the following code over the meta descritption  and meta keywords tags:

<?php $checkd = "default";
$checkd2 = htmlspecialchars($this->getDescription());
if($checkd2 == $checkd){ } else { ?>
<meta name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />
<?php } ?>
<?php $check = "default";
$check2 = htmlspecialchars($this->getKeywords());
if($check2 == $check){ } else { ?>
<meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />
<?php } ?>

Now if you go to: System > Configuration > Design > HTML Head

Type the word ‘default’ exactly into the default keywords and description fields and save. That’s all there is to it.

What the code does is check whether the keywords value is ‘default’, if it is it doesn’t show anything. If it’s not, it shows the keywords tag with the values you have otherwise specified. All CMS, category and product pages allow you to define unique keywords and descriptions.

  • Twitter
  • AIM
  • WordPress
  • LinkedIn
  • Facebook
  • StumbleUpon
  • Technorati Favorites
  • Delicious
  • Ping
  • Digg
  • Bebo
  • Reddit
  • MySpace
  • NewsVine
  • Google Bookmarks
  • Sphinn
  • Propeller
Categories: Magento, Magento Tutorials Tags:

Post A Comment