2013-03-21 57 views
4

我想知道按tweet和Google +按鈕時是否可以顯示一些預定義的文本。 我知道這是可能的Facebook,但我找不到任何可用的代碼爲谷歌+按鈕。在共享按鈕中顯示默認文本?

我已經得到了我的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> 

所以我的問題是,如果有可能顯示預定義的文本時,喜歡,分享或推文頁面或文章的某種谷歌+按鈕。

編輯


我希望能夠改變實際上當你單擊該按鈕顯示的文本。所以按鈕本身很好。

回答

2

你不能這樣做Facebook和Twitter提供,從我可以收集看他們的Snippet documentation

你可以做什麼,是這樣的:

<!-- 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> 
+0

您可以使用Open Graph元標記代替meta標籤上的itemprop。 http://ogp.me/ – 2013-04-03 14:53:02

+0

@BWRic這是給出Snippet文檔的代碼,如果OP遵循它推薦的鏈接** Open Graph protocol **,因爲它是第二個推薦的選擇。 – Prisoner 2013-04-03 15:51:11