Hugo 添加评论功能
Posted April 15, 2021 by clannadzsy ‐ 1 min read
Hugo 添加评论功能
layouts/blog/single.html
{{ define "main" }} <div class="row justify-content-center"> <div class="col-md-12 col-lg-10 col-xl-8"> <article> <div class="blog-header"> <h1>{{ .Title }}</h1> {{ partial "main/blog-meta.html" . }} </div> <p class="lead">{{ .Params.lead | safeHTML }}</p> {{ .Content }} </article> </div> </div> <!-- 添加评论 --> {{ if .Site.Params.utteranc.enable }} <script src="https://utteranc.es/client.js" repo="{{ .Site.Params.utteranc.repo }}" issue-term="{{ .Site.Params.utteranc.issueTerm }}" theme="{{ .Site.Params.utteranc.theme }}" crossorigin="anonymous" async> </script> {{ end }} {{ end }}
config/_default/config.toml
# 添加配置 [params.utteranc] enable = true repo = "CLannadZSY/CLannadZSY.github.io" issueTerm = "title" theme = "github-light"