基于next主题,给个人博客增加简单的百度分享功能

_config.yml

在配置百度分享功能时需指定其type,所以将主题配置_config.yml文件中关于baidushare部分的内容改为(其中type亦可以选择button):

baidushare:

type: slide

baidushare: true

下载

链接 https://github.com/hrwhisper/baiduShare

_config.yml中提示:Warning: Baidu Share does not support https.

因为百度分享不支持在https上使用,所以一种解决方法便是,直接放文件到我们自己的目录下面。

访问链接:

下载压缩包到本地,解压后,将static文件夹保存至themes\next\source目录下。

baidushare.swig

修改文件:themes\next\layout_partials\share\baidushare.swig

将文件 末尾 部分的代码进行修改:

.src=’http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];

改为

.src=’/static/api/js/share.js?v=89860593.js?cdnversion=’+~(-new Date()/36e5)];

最后重新生成下,就能展示分享功能了。

坚持原创技术分享,您的支持将鼓励我继续创作!