在 NexT 主题中使用 utterances 评论系统
安装主题
在博客目录执行指令安装主题
1 | npm i hexo-theme-next --save |
随后将 node_modules/hexo-theme-next/_config.yml
拷贝出来,命名为 _config.next.yml
以免与 hexo 自带的 _config.yml
冲突。
hexo 会优先读取 _config.next.yml
的主题配置,这样可以避免更新 nodejs 包时配置文件被覆盖。
1 | cp node_modules/hexo-theme-next/_config.yml _config.next.yml |
修改 _config.yml
中 theme
字段。
1 | theme: next |
添加 utterances
这个评论区基于 GitHub Issues, 需要一个公开的仓库,不妨新建一个。
然后前往 https://utteranc.es 查看文档说明.
“configuration” 中提到 “Install app”, 安装 utterances app, 使之获得仓库的读写权限。
进入后选择要授权的repo. GitHub 上就配置好了。
随后,在 _config.next.yml
中的 utterances 配置中添加 repo 路径 owner/repo
. 其他配置按自己喜好修改。
重新生成,就能看到了。
Callback 无法回到原网页
试图发送评论时,没法回到原来的网页。
观察返回的链接,似乎是我之前在 _config.yml
里面忘记修改的旧 url.
更新 url 即可。