Fork me on GitHub

如何使用DaoVoice与你的游客交流

如何使用DaoVoice与你的游客交流

偶然路过大佬Moorez的博客时发现了部署在他网站上的一款可以让游客与博主能够在线交流的应用DaoVoice,萌生了尝(zhuang)鲜(bi)的念头。

google未果,故阅读官方文档自己摸索了一阵,终于大功告成!✌

DaoVoice部署

创建应用

  1. 首先要去daovoice官网上注册一个账号

  2. 登陆后会进入DaoVoice应用创建引导页面:(公司名称可以随意填;电话其实只要符合格式就好了)

  3. 按规则填好后就会进入控制台界面:

找到你的appid并记住它

配置主题文件

  1. 进入文件路径:/themes/next/layout/_partials/head.swig,在最后写入如下代码:
{% 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/5e7162b1.js","daovoice")
    	daovoice('init', {
        app_id: "{{theme.daovoice_app_id}}"
    	});
    	daovoice('update');
    	{记得在这加上script标签}
    	{% endif %}

2 . 进入文件路径:/themes/next,打开主题配置文件_config.yml,在最后写入如下代码:

# Online contact 
daovoice: true
daovoice_app_id: #填入你的appid

现在可以hexo g -d部署到你的网站上看效果了

Adhere to original technology sharing, your support will encourage me to continue to create!