我想添加Google plus按钮。因此,用户可以使用Google plus分享产品。但是当我点击分享按钮然后产品名称,URL除产品图片外一切正确。 产品图像显示不正确。我在下面编写代码来创建Google Plus按钮代码。
<a href="#" onclick="popUp=window.open('https://plus.google.com/share?url=my_product_url', 'popupwindow', 'scrollbars=yes,width=800,height=400');popUp.focus();return false">Share on Gogole+</a>
我还尝试添加一些元标记来解决这个问题,但没有任何反应。
<meta property="og:title" content="..."/>
<meta property="og:image" content="..."/>
<meta property="og:description" content="..."/>
在排序方面,我需要在Google上显示当前产品详情和图片以及分享弹出窗口。
请尽快帮助我。
答案 0 :(得分:2)
如果您提供了示例网址,则会更容易分辨出错误,但听起来您的产品详细信息页面上有多个实体的标记。当发生这种情况时,片段获取器将从页面中的第一个实体获取图像。
使用此工具:http://www.google.com/webmasters/tools/richsnippets来测试您的代码段标记,并识别代码段提取程序所看到的实体。
您还应该看一下:https://developers.google.com/+/web/snippet/,它表明我们更喜欢您使用schema.org标记来描述您网页中的实体。
答案 1 :(得分:0)
您好在产品详情页面上添加以下代码
<?php $productName = $_helper->productAttribute($_product, $_product->getName(), ‘name’); ?>
<?php $productUrl = $_helper->productAttribute($_product, $_product->getProductUrl(), 'product_url'); ?>
<?php $productImage = $_product->getImageUrl() ?>
<a href="#" onclick="popUp=window.open('https://plus.google.com/share?url=<?php echo urlencode($productUrl); ?>', 'popupwindow', 'scrollbars=yes,width=800,height=400');popUp.focus();return false">Share on Gogole+</a>
希望这可以帮助你...