谷歌共享按钮抓取页面上的所有图像

时间:2017-03-15 21:16:11

标签: html google-plus opengraph share-button

我的目标是使用谷歌分享按钮,允许人们从我的博客分享内容。我使用了google分享代码段,如下所示:

<a target="_blank" href="https://plus.google.com/share?url=<? echo $permalink; ?>"><i class="fa fa-google-plus" aria-hidden="true"></i></a>

背景:

我博客中的每篇文章实际上都是餐厅评论。 经典餐厅评论页面包含带有<img>标签的滑块。我的侧边栏还包含一个带有<img>标签的滑块,用于最近的帖子。 要自定义我的Facebook分享按钮,我使用Open Graph标签,如下所示:

<link rel="canonical" href="http://grain2sel.fr/france/iledefrance/paris/mamie-burger" />
<link rel="publisher" href="https://plus.google.com/u/0/108380150528993749302"/>
<meta property="og:locale" content="fr_FR" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Mamie Burger - Grain2Sel" />
<meta property="og:description" content="Est-ce que votre grand-mère vous fait souvent des Burgers ? Moi j’ai trouvé la grand-mère à la pointe de la modernité et des..." />
<meta property="og:url" content="http://grain2sel.fr/france/iledefrance/paris/mamie-burger" />
<meta property="og:site_name" content="Grain2Sel" />
<meta property="article:publisher" content="https://www.facebook.com/grain2sel.fr/" />
<meta property="article:tag" content="Américain" />
<meta property="article:tag" content="Burger" />
<meta property="article:tag" content="En famille" />
<meta property="article:section" content="Paris" />
<meta property="article:published_time" content="2014-12-11T12:28:44+01:00" />
<meta property="article:modified_time" content="2017-03-13T15:01:40+01:00" />
<meta property="og:updated_time" content="2017-03-13T15:01:40+01:00" />
<meta property="fb:app_id" content="238884123187421" />
<meta property="og:image" content="http://grain2sel.fr/wp-content/uploads/2017/03/Mamie_burger_1-1280x720.jpg" />
<meta property="og:image:width" content="870" />
<meta property="og:image:height" content="489" />

根据我的阅读,我需要精确的谷歌:

<meta property="og:title" content="Mamie Burger - Grain2Sel" />
<meta property="og:description" content="Est-ce que votre grand-mère vous fait souvent des Burgers ? Moi j’ai trouvé la grand-mère à la pointe de la modernité et des..." />
<meta property="og:image" content="http://grain2sel.fr/wp-content/uploads/2017/03/Mamie_burger_1-1280x720.jpg" />

问题:

虽然标题和说明在共享弹出框中很好地显示,但我的页面中的所有图像也会被放置。 提供的第一个图像是og标记中的图像。然后从餐厅滑块的所有图像,最后从最近的帖子滑块的所有图像。 这些最后的图像显然不需要,因为它们与当前文章无关。

详细信息:

我也尝试过schema.org标签而没有任何改进。

问题:

  

是否可以强制共享者仅使用我选择的图像   og tag?

_

  

或是否可以从解析中删除其他图像   分享?

非常感谢你的帮助!

1 个答案:

答案 0 :(得分:3)

您无法告诉Google+排除图片。如果您不希望图像成为选项,则必须不将其包含在HTML响应中。您应该使用+Snippets告诉Google+您想要使用哪些图片,但Google+不保证会使用哪个图片。