Google+分享网址:它使用的参数是什么?

Vit*_*mar 25 share google-plus

我想在Stackoverflow上做出像.我没有+1按钮(加载需要一些时间,所有页面加载都慢一点).我查看了源页面,但没有找到任何信息...他们怎么做?

在facebook上这是:

url  = 'http://www.facebook.com/sharer.php?s=100';
url += '&p[title]='     + encodeURIComponent(title);
url += '&p[summary]='   + encodeURIComponent(text);
url += '&p[url]='       + encodeURIComponent(my_url);
url += '&p[images][0]=' + encodeURIComponent(pic);
Run Code Online (Sandbox Code Playgroud)

这样的东西必须是谷歌+分享到,但我没有在搜索过程中找到任何有用的信息.

我知道我可以使用这样的网址:https://plus.google.com/share?url=my_url,但这还不够 - 我还需要共享标题,文本和图像,但是为此目的使用什么url GET参数?

提前致谢!

mim*_*ing 32

共享链接支持两个网址PARAMATERS: url,目标URL,并且hl,对于语言代码.

目标网址上的结构化标记确定了Google+上分享的标题,说明和图片.例如,如果您将schema.org标记或OpenGraph标记添加到您正在共享的页面,它就会像+1按钮一样进行拾取.

在+ Snippet 的官方文档中,它表明schema.org标记是首选.因此,如果您向页面添加标记,如下所示:

<body itemscope itemtype="http://schema.org/Product">
  <h1 itemprop="name">Shiny Trinket</h1>
  <img itemprop="image" src="image-url"></img>
  <p itemprop="description">Shiny trinkets are shiny.</p>
</body>
Run Code Online (Sandbox Code Playgroud)

您将看到从name字段中读取的标题和来自恰当命名image字段的图像.

或者,您可以将OpenGraph标记添加到页面的头部,以指定相同的字段,如下所示:

<meta property="og:title" content="..."/>
<meta property="og:image" content="..."/>
<meta property="og:description" content="..."/>
Run Code Online (Sandbox Code Playgroud)

  • @ZeKoU您无法使用URL参数指定它们.您必须在目标页面中使用结构化标记. (2认同)