使用Utterances为Hugo添加评论功能
在github中添加Uterances
因为评论是存储在仓库的issue中,所以要给Uterances权限,添加时只需要给一个公有仓库的权限即可(通常是github pages)
生成产生评论的js脚本
输入repo,theme,点击copy即可
设置hugo theme
- layouts/partials/comments.html (没有则创建)
{{- /* Comments area start */ -}}
<!-- 上一步复制的东西 -->
{{- /* Comments area end */ -}}
- 修改layouts/_default/single.html
在</article>
之前添加下列内容
{{- if (.Param "comments") }}
{{- partial "comments.html" . }}
{{- end }}
- 修改config.yml
[Params]
...
comments = true
...
reference
Updated: 2023-07-05 22:01
Created: 2023-07-02 18:00