Add share button and statistics

添加分享

###方法一:原生分享

添加分享按钮代码, Hexo 文件夹下/theme/next/layout/_macro/post.swig

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<html xmlns:wb="http://open.weibo.com/wb">

<script src="http://tjs.sjs.sinajs.cn/open/api/js/wb.js" type="text/javascript" charset="utf-8"></script>

<wb:share-button appkey="2407521490" addition="simple" type="button"></wb:share-button>


<a href="https://twitter.com/share" class="twitter-share-button" data-via="gewillorg" data-size="large" data-count="none">Tweet</a>

<script>
!function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';
if(!d.getElementById(id)){
js=d.createElement(s);
js.id=id;js.src=p+'://platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js,fjs);
}
}
(document, 'script', 'twitter-wjs');
</script>

###方案二:ShareThis 定制

更加统一优美的解决方案,有个各种样式可选,非常方便。
稍后我再进行定制,最好是默认黑色,点击激活时恢复彩色。

默认有添加后缀在你的网址,去除方法如下 doNotHash: ture,详情参考:CopyNShare Settings

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({
publisher: "7fb5f31a-b8e7-4aa1-a6eb-9aac8b9b13f0", doNotHash: ture, doNotCopy: false, hashAddressBar: true});
</script>

<span class='st_sina_large' displayText='Sina'></span>
<span class='st_twitter_large' displayText='Tweet'></span>
<span class='st_facebook_large' displayText='Facebook'></span>
<span class='st_googleplus_large' displayText='Google +'></span>
<span class='st_pinterest_large' displayText='Pinterest'></span>
<span class='st_tumblr_large' displayText='Tumblr'></span>
<span class='st_reddit_large' displayText='Reddit'></span>


不蒜子统计

不蒜子”与百度统计谷歌分析等有区别:“不蒜子”可直接将访问次数显示在您在网页上。

添加统计代码, Hexo 文件夹下/theme/next/layout/_partials/footer.swig