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



我想在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);

像这样的东西一定是谷歌+共享的,但我在搜索过程中没有发现任何有用的信息。

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

提前感谢!

共享链接支持两个url参数:url用于目标url,hl用于语言代码。

目标url上的结构化标记决定了在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>

您将看到您的标题从name字段读取,图像从命名恰当的image字段读取。

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

<meta property="og:title" content="..."/>
<meta property="og:image" content="..."/>
<meta property="og:description" content="..."/>

也许下面关于分享互动帖子的页面会有所帮助:https://developers.google.com/+/网络/共享/交互式

我已经用参数"prefilt"对它进行了测试。此参数允许您通过get参数定义google+共享的预填充文本:

https://plus.google.com/share?url=my_url&prefilltext=my_prefired_text

因此,请深入查看交互式帖子页面,以便找到其他可能的get参数。

您可以使用"url"one_answers"prefilltext"。

您可以使用三个参数,如下所示:

https://plus.google.com/share?url={url}&text={desc}&hl={language_code}

来源:https://github.com/bradvin/social-share-urls/blob/master/README.md#google

最新更新