Hexo博客私有部署Twikoo评论系统并迁移评论记录
部署
之前一直使用的artalk,现在想改用Twikoo,采用私有部署的方式。
私有部署 (Docker)
端口可以根据实际情况进行修改1
docker run --name twikoo -e TWIKOO_THROTTLE=1000 -p 8100:8100 -v ${PWD}/data:/app/data -e TWIKOO_PORT=8100 -d imaegoo/twikoo
访问localhost:8100,结果如下则表示部署成功1
2
3
4
5{
    "code": 100,
    "message": "Twikoo 云函数运行正常,请参考 https://twikoo.js.org/frontend.html 完成前端的配置",
    "version": "1.6.39"
}
成功后,如果有域名,使用nginx配置反向代理即可。
Butterfly配置
打开butterfly的主题配置文件_config.yml,启用Twikoo1
2
3
4
5
6
7
8
9
10comments:
  # Up to two comments system, the first will be shown as default
  # Choose: Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/Artalk
  use: Twikoo
  text: true # Display the comment name next to the button
  # lazyload: The comment system will be load when comment element enters the browser's viewport.
  # If you set it to true, the comment count will be invalid
  lazyload: false
  count: false # Display comment count in post's top_img
  card_post_count: false # Display comment count in Home Page
配置环境Id,环境Id就是上一步你访问的地址。1
2
3
4
5
6
7# Twikoo
# https://github.com/imaegoo/twikoo
twikoo:
  envId: https://twikoo.xxx.xxx
  region:
  visitor: false
  option:
如果Twikoo前端版本过低,打开themes/butterfly/plugins.yml配置文件,修改版本。1
2
3
4twikoo:
  name: twikoo
  file: dist/twikoo.all.min.js
  version: 1.6.39
然后Hexo一键三连
Twikoo配置
在你的评论区,点击右下角设置小图片,初始化密码后,就可以进行配置啦!
迁移评论
首先从原来的评论系统,将评论数据导出,artalk导出是artrans格式。
然后在Twikoo设置中,选择导入,导入数据。
详细配置可参照Twikoo 文档










