添加utterances评论支持。由于pure主题集成了几个评论系统,所以增加一个还算简单。
参考链接
Hexo NexT 使用 utterances 评论区
hexo-fluid添加utterances评论功能(详细图文过程)
新建utterances.ejs
在themes\pure\layout\_script\_comment\目录新建utterances.ejs文件,文件内容如下:
1 | <% if (typeof(script) !== 'undefined' && script) { %> |
更改comment.ejs文件
注意:
comment.ejs文件有两个
一、更改themes\pure\layout\_script\comment.ejs代码
打开themes\pure\layout\_script\comment.ejs,在最后添加如下代码:
1 | <% } else if (theme.comment.type === 'valine') { %> |
注意
1 | <% } else if (theme.comment.type === 'valine') { %> |
这段代码是原来就有的,也可以插在这个文件其他合适的位置
二、更改themes\pure\layout\_partial\post\comment.ejs代码
打开themes\pure\layout\_partial\post\comment.ejs,插入如下代码
1 | <% } else if (theme.comment.type === 'gitalk') { %> |
注意
1 | <% } else if (theme.comment.type === 'gitalk') { %> |
这段代码是原来就有的,<% } else if (theme.comment.type === 'utterances') { %>,也可以插在其他合适位置
更改主题配置文件
打开themes\pure\_config.yml
找到comment,在对应位置加入:
1 | comment: |
其中的参数可以去https://utteranc.es/了解
