<divid="gitalk-container"style="border:0"></div><script>vargitalk=newGitalk({clientID:'{{ .Site.Params.Gitalk.clientID }}',clientSecret:'{{ .Site.Params.Gitalk.clientSecret }}',repo:'{{ .Site.Params.Gitalk.repo }}',owner:'{{ .Site.Params.Gitalk.owner }}',admin:['{{ .Site.Params.Gitalk.owner }}'],id:{{.Title}},// Ensure uniqueness and length less than 50
distractionFreeMode:false// Facebook-like distraction free mode
createIssueManually:'{{ .Site.Params.Gitalk.createIssueManually }}'})gitalk.render('gitalk-container')</script>
其中相关信息替换成github帐号的真实信息
clientID、clientSecret填写上面申请的github application信息
repo、owner、admin写自己准备把评论放在的仓库名
id为页面唯一标识
2.3 修改single.html
将
1
2
3
4
5
<section>{{ if (default true .Params.comments) }}
{{ template "_internal/disqus.html" . }}
{{ end }}
</section>
替换成
1
2
3
4
5
<section>{{ if (default true .Params.comments) }}
{{ partial "comment.html" . }}
{{ end }}
</section>
2.4 修改config.yaml
根据comment.html的内容更改相关参数
1
2
3
4
5
6
7
[Params.Gitalk]
clientID = "" # Your client ID
clientSecret = "" # Your client secret
repo = "" # The repo to store comments
owner = "" # Your GitHub ID
admin= "" # Required. Github repository owner and collaborators. (Users who having write access to this repository)
createIssueManually= false # If it is 'false', it is auto to make a Github issue