Hexo-NexT接入网页在线联系功能

注册

首先在DaoVoice注册个账号,支持github、微信注册,开启DaoVoice之旅,邀请码是1e963cbc,点击创建。

修改head.swig

打开/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 %}

修改next配置文件

首先去daovoice后台找到自己的app_id,正常刚进入的页面就会显示,或者会提示你点击接入,只需点击接入就可看到,然后在_config.yml文件中添加内容:

1
2
3
# Online contact
daovoice: true
daovoice_app_id: 1e963cbc # app_id

聊天窗口配置

进入daovoice后台,点击应用设置,点击聊天设置,开始配置,下面是我的配置参数:

大功告成,欢迎开撩。

-----------------------本文结束感谢您的阅读-----------------------
坚持原创技术分享,您的支持将鼓励我继续创作!
0%