Add Meta for Facebook with Custom Product PageHow to put Meta Title PageProduct view and search result on the sameFacebook Dynamic Product AdsHtml validation issue for facebook sharing on product pageHow to change dynamic attributes when simple product is selectedFacebook Product ShareEditing Facebook OG: Meta TagsAdd custom product attributes as prefill mask for meta fieldsProduct feed with 2 Facebook PageExport Category name in xml feed Magento 1.9.2
Applicants clearly not having the skills they advertise
How to make thick Asian sauces?
In this example, which path would a monster affected by the Dissonant Whispers spell take?
Do I include animal companions when calculating difficulty of an encounter?
How certain is a caster of when their spell will end?
Why is the relationship between frequency and pitch exponential?
I wrote a scene that the majority of my readers loved. How do I get back to that place while writing my new book?
Who operates delivery flights for commercial airlines?
What do we gain with higher order logics?
Why don't B747s start takeoffs with full throttle?
Avoiding cliches when writing gods
Incremental Ranges!
Shrink exponential fraction argument
Diet Coke or water?
X-shaped crossword
Is there any word or phrase for negative bearing?
Old black and white movie: glowing black rocks slowly turn you into stone upon touch
How to decline physical affection from a child whose parents are pressuring them?
Convert camelCase and PascalCase to Title Case
Is the capacitor drawn or wired wrongly?
Replace only 2nd, 3rd, nth...character and onwards
How were concentration and extermination camp guards recruited?
Count down from 0 to 5 seconds and repeat
Why do guitarists wave their guitars?
Add Meta for Facebook with Custom Product Page
How to put Meta Title PageProduct view and search result on the sameFacebook Dynamic Product AdsHtml validation issue for facebook sharing on product pageHow to change dynamic attributes when simple product is selectedFacebook Product ShareEditing Facebook OG: Meta TagsAdd custom product attributes as prefill mask for meta fieldsProduct feed with 2 Facebook PageExport Category name in xml feed Magento 1.9.2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have this custom product page but the meta information is not correct.
<?php
$og = [];
$og['title'] = $this->getTitle();
$og['site_name'] = Mage::app()->getStore()->getName();
$og['description'] = strip_tags($this->getDescription());
$og['url'] = $this->helper('core/url')->getCurrentUrl();
if(Mage::registry('current_product')):
$product = Mage::registry('current_product');
$og['title'] = $product->getName();
$og['type'] = 'product';
$og['image'] = $this->helper('catalog/image')->init($product, 'small_image')->resize(100,100);
$og['description'] = strip_tags(($product->getShortDescription()));
$og['price:amount'] = Mage::registry('product')->getFinalPrice();
$og['price:currency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
elseif(Mage::registry('current_category')):
$og['type'] = 'product.group';
elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) :
$og['type'] = 'website';
else:
$og['type'] = 'article';
endif;
?>
I use that code to Integrate the meta for check different kind of page in the Site. The code consider the Product as an Article Type.
According to the Facebook Share Debugger, it still a missing IMG.
And the page is considered to be an Article Type not a Product Type.
magento-1.9 facebook meta
add a comment |
I have this custom product page but the meta information is not correct.
<?php
$og = [];
$og['title'] = $this->getTitle();
$og['site_name'] = Mage::app()->getStore()->getName();
$og['description'] = strip_tags($this->getDescription());
$og['url'] = $this->helper('core/url')->getCurrentUrl();
if(Mage::registry('current_product')):
$product = Mage::registry('current_product');
$og['title'] = $product->getName();
$og['type'] = 'product';
$og['image'] = $this->helper('catalog/image')->init($product, 'small_image')->resize(100,100);
$og['description'] = strip_tags(($product->getShortDescription()));
$og['price:amount'] = Mage::registry('product')->getFinalPrice();
$og['price:currency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
elseif(Mage::registry('current_category')):
$og['type'] = 'product.group';
elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) :
$og['type'] = 'website';
else:
$og['type'] = 'article';
endif;
?>
I use that code to Integrate the meta for check different kind of page in the Site. The code consider the Product as an Article Type.
According to the Facebook Share Debugger, it still a missing IMG.
And the page is considered to be an Article Type not a Product Type.
magento-1.9 facebook meta
add a comment |
I have this custom product page but the meta information is not correct.
<?php
$og = [];
$og['title'] = $this->getTitle();
$og['site_name'] = Mage::app()->getStore()->getName();
$og['description'] = strip_tags($this->getDescription());
$og['url'] = $this->helper('core/url')->getCurrentUrl();
if(Mage::registry('current_product')):
$product = Mage::registry('current_product');
$og['title'] = $product->getName();
$og['type'] = 'product';
$og['image'] = $this->helper('catalog/image')->init($product, 'small_image')->resize(100,100);
$og['description'] = strip_tags(($product->getShortDescription()));
$og['price:amount'] = Mage::registry('product')->getFinalPrice();
$og['price:currency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
elseif(Mage::registry('current_category')):
$og['type'] = 'product.group';
elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) :
$og['type'] = 'website';
else:
$og['type'] = 'article';
endif;
?>
I use that code to Integrate the meta for check different kind of page in the Site. The code consider the Product as an Article Type.
According to the Facebook Share Debugger, it still a missing IMG.
And the page is considered to be an Article Type not a Product Type.
magento-1.9 facebook meta
I have this custom product page but the meta information is not correct.
<?php
$og = [];
$og['title'] = $this->getTitle();
$og['site_name'] = Mage::app()->getStore()->getName();
$og['description'] = strip_tags($this->getDescription());
$og['url'] = $this->helper('core/url')->getCurrentUrl();
if(Mage::registry('current_product')):
$product = Mage::registry('current_product');
$og['title'] = $product->getName();
$og['type'] = 'product';
$og['image'] = $this->helper('catalog/image')->init($product, 'small_image')->resize(100,100);
$og['description'] = strip_tags(($product->getShortDescription()));
$og['price:amount'] = Mage::registry('product')->getFinalPrice();
$og['price:currency'] = Mage::app()->getStore()->getCurrentCurrencyCode();
elseif(Mage::registry('current_category')):
$og['type'] = 'product.group';
elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) :
$og['type'] = 'website';
else:
$og['type'] = 'article';
endif;
?>
I use that code to Integrate the meta for check different kind of page in the Site. The code consider the Product as an Article Type.
According to the Facebook Share Debugger, it still a missing IMG.
And the page is considered to be an Article Type not a Product Type.
magento-1.9 facebook meta
magento-1.9 facebook meta
asked Apr 21 '16 at 1:39
AlenAlen
1991214
1991214
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Try to use this snippet, that works on sites I´ve worked on and is build up a little different then the one you use right now.
Just give it a try maybe.
<?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="product.group" />
<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 elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) : ?>
<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="article" />
<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; ?>
the only problem is that the code if(Mage::registry('current_product')) is not consider. the product page is being detect as "Article" mentioned on above post.
– Alen
Apr 26 '16 at 9:33
I updated it and you should try again
– Klettseb
Apr 27 '16 at 14:21
add a comment |
You can add this snippet into tag in app/design/frontend/Theme_name/Theme_name/template/page/html/head.phtml
<?php /* Open Graph Protocol for Facebook and SEO START */ ?>
<?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')): ?>
<?php $category = Mage::registry('current_category'); ?>
<meta property="og:title" content="<?php echo $this->getTitle() ?>" />
<meta property="og:type" content="product.group" />
<meta property="og:image" content="<?php echo $category->getImageUrl(); ?>" />
<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 elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) : ?>
<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 echoMage::app()->getStore()->getName(); ?>" />
<?php else: ?>
<meta property="og:title" content="<?php echo $this->getTitle() ?>" />
<meta property="og:type" content="article" />
<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; ?>
<?php /* Open Graph Protocol for Facebook and SEO END */ ?>
It will surely help you.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f111841%2fadd-meta-for-facebook-with-custom-product-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try to use this snippet, that works on sites I´ve worked on and is build up a little different then the one you use right now.
Just give it a try maybe.
<?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="product.group" />
<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 elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) : ?>
<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="article" />
<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; ?>
the only problem is that the code if(Mage::registry('current_product')) is not consider. the product page is being detect as "Article" mentioned on above post.
– Alen
Apr 26 '16 at 9:33
I updated it and you should try again
– Klettseb
Apr 27 '16 at 14:21
add a comment |
Try to use this snippet, that works on sites I´ve worked on and is build up a little different then the one you use right now.
Just give it a try maybe.
<?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="product.group" />
<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 elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) : ?>
<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="article" />
<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; ?>
the only problem is that the code if(Mage::registry('current_product')) is not consider. the product page is being detect as "Article" mentioned on above post.
– Alen
Apr 26 '16 at 9:33
I updated it and you should try again
– Klettseb
Apr 27 '16 at 14:21
add a comment |
Try to use this snippet, that works on sites I´ve worked on and is build up a little different then the one you use right now.
Just give it a try maybe.
<?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="product.group" />
<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 elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) : ?>
<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="article" />
<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; ?>
Try to use this snippet, that works on sites I´ve worked on and is build up a little different then the one you use right now.
Just give it a try maybe.
<?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="product.group" />
<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 elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) : ?>
<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="article" />
<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; ?>
edited Apr 27 '16 at 14:21
answered Apr 25 '16 at 11:54
KlettsebKlettseb
3,03531851
3,03531851
the only problem is that the code if(Mage::registry('current_product')) is not consider. the product page is being detect as "Article" mentioned on above post.
– Alen
Apr 26 '16 at 9:33
I updated it and you should try again
– Klettseb
Apr 27 '16 at 14:21
add a comment |
the only problem is that the code if(Mage::registry('current_product')) is not consider. the product page is being detect as "Article" mentioned on above post.
– Alen
Apr 26 '16 at 9:33
I updated it and you should try again
– Klettseb
Apr 27 '16 at 14:21
the only problem is that the code if(Mage::registry('current_product')) is not consider. the product page is being detect as "Article" mentioned on above post.
– Alen
Apr 26 '16 at 9:33
the only problem is that the code if(Mage::registry('current_product')) is not consider. the product page is being detect as "Article" mentioned on above post.
– Alen
Apr 26 '16 at 9:33
I updated it and you should try again
– Klettseb
Apr 27 '16 at 14:21
I updated it and you should try again
– Klettseb
Apr 27 '16 at 14:21
add a comment |
You can add this snippet into tag in app/design/frontend/Theme_name/Theme_name/template/page/html/head.phtml
<?php /* Open Graph Protocol for Facebook and SEO START */ ?>
<?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')): ?>
<?php $category = Mage::registry('current_category'); ?>
<meta property="og:title" content="<?php echo $this->getTitle() ?>" />
<meta property="og:type" content="product.group" />
<meta property="og:image" content="<?php echo $category->getImageUrl(); ?>" />
<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 elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) : ?>
<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 echoMage::app()->getStore()->getName(); ?>" />
<?php else: ?>
<meta property="og:title" content="<?php echo $this->getTitle() ?>" />
<meta property="og:type" content="article" />
<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; ?>
<?php /* Open Graph Protocol for Facebook and SEO END */ ?>
It will surely help you.
add a comment |
You can add this snippet into tag in app/design/frontend/Theme_name/Theme_name/template/page/html/head.phtml
<?php /* Open Graph Protocol for Facebook and SEO START */ ?>
<?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')): ?>
<?php $category = Mage::registry('current_category'); ?>
<meta property="og:title" content="<?php echo $this->getTitle() ?>" />
<meta property="og:type" content="product.group" />
<meta property="og:image" content="<?php echo $category->getImageUrl(); ?>" />
<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 elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) : ?>
<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 echoMage::app()->getStore()->getName(); ?>" />
<?php else: ?>
<meta property="og:title" content="<?php echo $this->getTitle() ?>" />
<meta property="og:type" content="article" />
<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; ?>
<?php /* Open Graph Protocol for Facebook and SEO END */ ?>
It will surely help you.
add a comment |
You can add this snippet into tag in app/design/frontend/Theme_name/Theme_name/template/page/html/head.phtml
<?php /* Open Graph Protocol for Facebook and SEO START */ ?>
<?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')): ?>
<?php $category = Mage::registry('current_category'); ?>
<meta property="og:title" content="<?php echo $this->getTitle() ?>" />
<meta property="og:type" content="product.group" />
<meta property="og:image" content="<?php echo $category->getImageUrl(); ?>" />
<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 elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) : ?>
<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 echoMage::app()->getStore()->getName(); ?>" />
<?php else: ?>
<meta property="og:title" content="<?php echo $this->getTitle() ?>" />
<meta property="og:type" content="article" />
<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; ?>
<?php /* Open Graph Protocol for Facebook and SEO END */ ?>
It will surely help you.
You can add this snippet into tag in app/design/frontend/Theme_name/Theme_name/template/page/html/head.phtml
<?php /* Open Graph Protocol for Facebook and SEO START */ ?>
<?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')): ?>
<?php $category = Mage::registry('current_category'); ?>
<meta property="og:title" content="<?php echo $this->getTitle() ?>" />
<meta property="og:type" content="product.group" />
<meta property="og:image" content="<?php echo $category->getImageUrl(); ?>" />
<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 elseif((Mage::getSingleton('cms/page')->getIdentifier() == 'home' &&Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) : ?>
<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 echoMage::app()->getStore()->getName(); ?>" />
<?php else: ?>
<meta property="og:title" content="<?php echo $this->getTitle() ?>" />
<meta property="og:type" content="article" />
<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; ?>
<?php /* Open Graph Protocol for Facebook and SEO END */ ?>
It will surely help you.
answered Jul 19 '17 at 6:00
Pasupathi ThangavelPasupathi Thangavel
1233
1233
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f111841%2fadd-meta-for-facebook-with-custom-product-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown