0%

hexo+next主题美化四

前言

由于看见别人的博客里面都有在线留言,在线聊天功能,感觉挺有趣的,因此我也想给我的博客配置这个功能,感觉还十分的有趣,哈哈,废话不多说,开搞。

步骤详解

(1)在DaoCloud网站https://dashboard.daocloud.io/ 注册账号,并登录

(2)点击左边栏的 应用设置——>安装到网站 ,可以查看自己的app_id

(3)修改/themes/next/layout/_partials/head.swig文件,添加内容如下:

1
2
3
4
5
6
7
8
9
{% if theme.daovoice %}
<script>
(function(i,s,o,g,r,a,m){i["DaoVoiceObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;a.charset="utf-8";m.parentNode.insertBefore(a,m)})(window,document,"script",('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/0f81ff2f.js","daovoice")
daovoice('init', {
app_id: "{{theme.daovoice_app_id}}"
});
daovoice('update');
</script>
{% endif %}

(4)修改主题的配置文件,添加以下代码:

1
2
3
4

# Online contact
daovoice: true
daovoice_app_id: 0d207805

(5) 到这就已经完成了,hexo s 运行自己的博客,效果如下:

结束语

有问题欢迎留言哦,记得双击,么么哒!

-------- 本文结束 感谢阅读 --------