I added the following code to the head
<meta http-equiv="Content-Type" content="<?php echo $ this->getContentType() ?>" /> <title><?php echo $ this->getTitle() ?></title> <meta name="description" content="<?php echo htmlspecialchars($ this->getDescription()) ?>" /> <meta name="keywords" content="<?php echo htmlspecialchars($ this->getKeywords()) ?>" /> <meta name="robots" content="<?php echo htmlspecialchars($ this->getRobots()) ?>" /> <meta name="author" content="Hope Collective" /> <meta property="og:type" content="website"/> <meta property="og:title" content="<?php echo $ this->getTitle() ?>" /> <meta property="og:description" content="<?php echo htmlspecialchars($ this->getDescription()) ?>"/> <meta property="og:image" content="https://hopecollective.com/hope_collective_logo@3x.png"/> <meta property="og:url" content="<?php echo $ this->getCurrentUrl() ?>"/> <meta property="og:locale" content="en_US" /> <meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName() ?>"/> <meta name="twitter:card" content="summary" /> <meta name="twitter:site" content="@HopeCollect" /> <meta name="twitter:title" content="<?php echo $ this->getTitle() ?>" /> <meta name="twitter:description" content="<?php echo htmlspecialchars($ this->getDescription()) ?>" /> <meta name="twitter:image" content="https://hopecollective.com/hope_collective_logo@3x.png" /> <meta property="fb:app_id" content="125773904784788" /> <?php if($ isResponsive){?> <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1" /> <?php }?> <?php $ product = Mage::registry('current_product'); if ($ product): ?> <meta property="og:type" content="product" /> <meta property="og:title" content="<?php echo $ product->getName(); ?>" /> <meta property="og:description" content="<?php echo strip_tags($ product->getShortDescription()); ?>" /> <meta property="og:url" content="<?php echo $ this->helper('catalog/product')->getProductUrl($ product); ?>" /> <meta property="og:image" content="<?php echo $ this->helper('catalog/image')->init($ product, 'image')->resize(300, 300); ?>" /> <meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName() ?>" /> <meta name="twitter:card" content="product"> <meta name="twitter:title" content="<?php echo $ product->getName(); ?>" /> <meta name="twitter:description" content="<?php echo strip_tags($ product->getShortDescription()); ?>" /> <meta name="twitter:image" content="<?php echo $ this->helper('catalog/image')->init($ product, 'image')->resize(300, 300); ?>" /> <meta name="twitter:data1" content="$ <?php echo number_format($ product->getPrice(),2);?>"> <meta name="twitter:label1" content="PRICE"> <meta name="twitter:site" value="@HopeCollect"> <meta property="fb:app_id" content="125773904784788" /> <?php endif; ?>
Its pretty much working fine except for 2 issues with facebook debugger is not calling the correct product image (og:image). Its calling the default og:image which i added above if product part. But the code is working perfectly fine on twitter card validator. Its show the correct product image. Also the og:type comes as website for products.
Any idea where I’m going wrong??