Created
December 18, 2014 03:39
-
-
Save imsamthomas/9f661e2af7e92b5df258 to your computer and use it in GitHub Desktop.
Meta tag for Social network - Snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php /* Open Graph Protocol for Facebook and SEO */ ?> | |
| <?php if(Mage::registry('current_product')): ?> | |
| <?php $product = Mage::registry('current_product'); ?> | |
| <meta property="og:title" content="<?php echo ($product->getName()); ?>" /> | |
| <meta property="og:type" content="product" /> | |
| <meta property="og:image" content="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize(200,200);?>" /> | |
| <meta property="og:url" content="<?php echo Mage::registry('product')->getProductUrl(); ?>" /> | |
| <meta property="og:description" content="<?php echo strip_tags(($product->getShortDescription())); ?>" /> | |
| <meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName(); ?>" /> | |
| <?php elseif(Mage::registry('current_category')): ?> | |
| <meta property="og:title" content="<?php echo $this->getTitle() ?>" /> | |
| <meta property="og:type" content="website" /> | |
| <meta property="og:url" content="<?php echo $this->helper('core/url')->getCurrentUrl();?>" /> | |
| <meta property="og:description" content="<?php echo strip_tags($this->getDescription()) ?>" /> | |
| <meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName(); ?>" /> | |
| <?php else: ?> | |
| <meta property="og:title" content="<?php echo $this->getTitle() ?>" /> | |
| <meta property="og:type" content="website" /> | |
| <meta property="og:url" content="<?php echo $this->helper('core/url')->getCurrentUrl();?>" /> | |
| <meta property="og:description" content="<?php echo strip_tags($this->getDescription()) ?>" /> | |
| <meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName(); ?>" /> | |
| <?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment