【问题标题】:Show defaulted text in a share button?在共享按钮中显示默认文本?
【发布时间】:2013-03-21 08:04:02
【问题描述】:

我想知道在按下推文和 google+ 按钮时是否可以显示一些预定义的文本。 我知道这对 facebook 来说是可行的,但我找不到任何可用于 google+ 按钮的代码。

我的 facebook 分享按钮的代码(已经在工作)是:

<a title="send to Facebook"
 href="http://www.facebook.com/sharer.php?s=100&p[title]=EHBE Groningen&p[summary]=this is the text to share http://sharelink.com&p[url]=www.example.nl&p[images][0]=example_image"
 target="_blank">
 <span>
  <img width="14" height="14" src="'icons/fb.gif" alt="Facebook" /> Facebook 
 </span>
</a>

我目前为我的推文按钮获得的代码(也可以使用)是:

<a href="http://twitter.com/?status=text to tweet" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://twitter.com']);" target="_blank">Tweet over deze pagina</a>

所以我的问题是,是否可以在为某种 google + 按钮点赞、分享或推特页面或文章时显示预定义的文本。

编辑


我希望能够更改实际单击按钮时出现的文本。所以按钮本身没问题。

【问题讨论】:

    标签: html button share


    【解决方案1】:

    从我收集到的Snippet documentation 来看,你无法做到 facebook 和 twitter 提供的方式。

    你能做什么,是这样的:

    <!-- Update your html tag to include the itemscope and itemtype attributes. -->
    <html itemscope itemtype="http://schema.org/Article">
    
    <!-- Add the following three tags inside head. -->
    <meta itemprop="name" content="my title">
    <meta itemprop="description" content="a description">
    <meta itemprop="image" content="http://my-url.com/logo.png">
    

    我意识到如果您的内容是通过AJAX 加载的,这可能会很痛苦。在这种情况下,您可以执行以下操作:

    <body itemscope itemtype="http://schema.org/Product">
      <h1 itemprop="name">my title</h1>
      <img itemprop="image" src="http://my-url.com/logo.png" />
      <p itemprop="description">a description</p>
    </body>
    

    【讨论】:

    • 您可以使用 Open Graph 元标记来代替元标记上的 itemprops。 ogp.me
    • @BWRic 这是给出 Snippet 文档的代码,如果 OP 遵循链接,它推荐 Open Graph 协议 作为第二个推荐选择。
    【解决方案2】:

    https://developers.google.com/+/web/+1button/

    读取并添加这些标签/代码。

    【讨论】:

    • 我认为您没有得到我的问题,我希望能够更改您实际单击按钮时出现的文本。所以按钮本身没问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-07
    • 2023-03-14
    • 2013-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多