百度分享如何自定義分享url和內(nèi)容?

2013-04-16 21:42:47來源:西部e網(wǎng)作者:

百度分享默認(rèn)分享的是當(dāng)前頁的url,但也可以在同一個頁面中分享多個不同的url,僅需進(jìn)行如下簡單的配置。

百度分享默認(rèn)分享的是當(dāng)前頁的url,但也可以在同一個頁面中分享多個不同的url,僅需進(jìn)行如下簡單的配置。

默認(rèn)的代碼如下:

<div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare">

其實是有很多隱藏的參數(shù)的:

<div id="bdshare" class="bdshare_t bds_tools_32 get-codes-bdshare" data="{
'bdDes':'您的自定義分享摘要',  //'請參考自定義分享摘要'
'text':'您的自定義分享內(nèi)容',  //'請參考自定義分享內(nèi)容'
'title':'您的自定義pop窗口標(biāo)題', //'請參考自定義pop窗口標(biāo)題'
'pic':'您的自定義分享出去的圖片', //'請參考自定義分享出去的圖片'
'bdComment':'您的自定義分享評論', //'請參考自定義分享評論'
'url':'您的自定義分享url',  //'請參考自定義分享url',
'wbuid':'您的自定義微博 ID'
}">

如果想自定義url,只需要寫如下代碼即可,紅色文字部分就是增加的url:

<!-- Baidu Button BEGIN -->
<div id="bdshare" class="bdshare_t bds_tools_32 get-codes-bdshare" data="{'url':'http://virtualinteriordefine.com/index.html'}">
    <span class="bds_more">更多</span>
    <a class="bds_tsina">新浪</a>
    <a class="bds_tqq">騰訊</a>
    <a class="bds_renren">人人</a>
    <a class="bds_qzone">QQ </a>
</div>
<script type="text/javascript" id="bdshare_js" data="type=tools" ></script>
    <script type="text/javascript" id="bdshell_js"></script>
    <script type="text/javascript">
        document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000);
    </script>
<!-- Baidu Button END -->

其他比如自定義圖片、標(biāo)題或者內(nèi)容都可以按照上面的參數(shù)進(jìn)行設(shè)置。

更多的設(shè)置請參考:http://share.baidu.com/help/customization/config

 

關(guān)鍵詞:百度分享

贊助商鏈接: