hexo使用next主题,并且使用”多说“给博客的文章添加评论功能

使用next主题:

 

1、下载next: git clone https://github.com/iissnan/hexo-theme-next themes/next

2、修改配置:_config.yml配置项theme

      theme:next

 

使用”多说“给博客的文章添加评论功能:(附加:我是微信登录的)

1、在多说网站新建一个站点,并且获取一个多说域名,我填写的是yuzhiyun,然后填写需要使用评论功能的域名,我填写的是http://www.yuzhyun.me/

2、在多说网站的后台的“工具”tab 下获取到通用代码:

<!-- 多说评论框 start -->
	<div class="ds-thread" data-thread-key="请将此处替换成文章在你的站点中的ID" data-title="请替换成文章的标题" data-url="请替换成文章的网址"></div>
<!-- 多说评论框 end -->
<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
<script type="text/javascript">
var duoshuoQuery = {short_name:"yuzhiyun"};
	(function() {
		var ds = document.createElement('script');
		ds.type = 'text/javascript';ds.async = true;
		ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
		ds.charset = 'UTF-8';
		(document.getElementsByTagName('head')[0] 
		 || document.getElementsByTagName('body')[0]).appendChild(ds);
	})();
	</script>
<!-- 多说公共JS代码 end -->
 3、找到本地theme下你正在使用的hexo主题,我的是next,  打开F:\hexo\themes\next目录下的_config.yml配置文件,找到 duoshuo_shortname标签,设置为刚才创建站点时 多说域名中的内容,请注意,没有前缀 http://和后缀 .duoshuo.com.   ,比如我的就是 yuzhiyun

4、修改F:\hexo\themes\next\layout\_partials目录下的comment.swing文件,把在dushuo网站上获取的通用代码黏贴到{% if page.comments %}  和{% endif %}之间。同时需要再修改一点,把

<!-- 多说评论框 start -->
	<div class="ds-thread" data-thread-key="请将此处替换成文章在你的站点中的ID" data-title="请替换成文章的标题" data-url="请替换成文章的网址"></div>

 替换成:

  <!-- 多说评论框 start -->
 		<div class="ds-thread" data-thread-key="<%- page.path %>" data-title="<%- page.title %>" data-url="<%- page.permalink %>"></div>
<!-- 多说评论框 end -->

 5、更新到github

效果如图:



 

 

 

 

猜你喜欢

转载自2723364262.iteye.com/blog/2319384