直接官方步骤 https://github.com/gitalk/gitalk/blob/master/readme-cn.md

基于本站主题做了一些修改

主题目录下新建 partials/gitalk.html, 加入

{{ if .Site.Params.enableGitalk }}
<div id="gitalk-container"></div>
<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
<style>
    .gt-header-textarea { background: #333 !important; color: #999; }
    .gt-container .gt-btn { background: #3b3d42 !important; color: #a9a9b3; border-color: #3b3d42; }
    .gt-container .gt-header-controls-tip { color: #a9a9b3; text-decoration: underline; }
    .gt-container .gt-link { color: #a9a9b3;  }
    .gt-container .gt-popup {  background: #3b3d42 !important; color: #a9a9b3;}
</style>
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
<script>
  var gitalk = new Gitalk({
  clientID: '应用ID',
  clientSecret: '应用Secret',
  repo: 'GitHub repo',
  owner: 'GitHub repo owner',
  admin: ['GitHub repo owner and collaborators, only these guys can initialize github issues'],
  id: location.pathname,      // Ensure uniqueness and length less than 50
  distractionFreeMode: false  // Facebook-like distraction free mode
})

gitalk.render('gitalk-container')
</script>
{{ end }}

其中style部分是让评论的主题更适合本站的主题, 其他主题可考虑去掉

同目录的single.html里适当位置加入

{{ partial "gitalk.html" . }}

博客目录配置文件config.toml里加入

[params]
  enableGitalk = true