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 下获取到通用代码:

  1. <!-- 多说评论框 start -->  
  2.     <div class="ds-thread" data-thread-key="请将此处替换成文章在你的站点中的ID" data-title="请替换成文章的标题" data-url="请替换成文章的网址"></div>  
  3. <!-- 多说评论框 end -->  
  4. <!-- 多说公共JS代码 start (一个网页只需插入一次) -->  
  5. <script type="text/javascript">  
  6. var duoshuoQuery = {short_name:"yuzhiyun"};  
  7.     (function() {  
  8.         var ds = document.createElement('script');  
  9.         ds.type = 'text/javascript';ds.async = true;  
  10.         ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';  
  11.         ds.charset = 'UTF-8';  
  12.         (document.getElementsByTagName('head')[0]   
  13.          || document.getElementsByTagName('body')[0]).appendChild(ds);  
  14.     })();  
  15.     </script>  
  16. <!-- 多说公共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 %}之间。同时需要再修改一点,把

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

 替换成:

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

 5、更新到github

效果如图:



 

猜你喜欢

转载自blog.csdn.net/hhgggggg/article/details/77859668