在 Hexo NexT 中使用
在 Hexo NexT 中使用我的 NexT 版本是 5.1.4,不知道最新的版本有没有集成 utterances ,
如果有一般在主题配置文件中添加相关 utterances 配置即可。
但我使用 5.1.4 版本没有集成,需要修改NexT的布局文件,不然单添加配置不会在页面中看到效果的。
几个重要步骤:
编辑 Hexo 主题配置文件 _config.yml,添加以下配置
1 | # 整合 utterances 评论 |
在主题的 layout/_third-party/comments 目录中添加 utterance.swig文件:
1 | {% if theme.utterance and theme.utterance.enable %} |
编辑 layout/_third-party/comments/index.swig,添加以下配置加入 utterance.swig 文件:
1 | {% include 'utterance.swig' %} |
编辑 layout/_partials/comments.swig 文件,在最后加入以下内容,配置存放评论的 dom 元素:
1 | {% elseif theme.utterance.enable %} |