add custom comment

This commit is contained in:
qaqland 2022-04-13 19:12:21 +08:00
parent 5a2a7cc35a
commit 36ce31b835
3 changed files with 20 additions and 13 deletions

View file

@ -0,0 +1,17 @@
<script>
const repo = '{{ .Site.Params.utterances.repo }}'
const issueTerm = '{{ .Site.Params.utterances.issueTerm }}'
const theme = localStorage.theme ? `github-${localStorage.theme}` : 'preferred-color-scheme';
const script = document.createElement('script')
script.src = 'https://utteranc.es/client.js'
script.async = true
script.crossOrigin = 'anonymous'
script.setAttribute('repo', repo)
script.setAttribute('issue-term', issueTerm)
script.setAttribute('theme', theme)
script.setAttribute('label', 'comment')
document.querySelector('main').appendChild(script)
</script>

View file

@ -37,16 +37,6 @@
{{ end }}
{{ if or .Params.comment (and .Site.Params.commentOnAllPosts (ne .Params.comment false)) }}
{{ if eq .Site.Params.comment "disqus"}}
{{ partial "disqus.html" . }}
{{ end }}
{{ if eq .Site.Params.comment "ovo"}}
{{ partial "ovo.html" . }}
{{ end }}
{{ if eq .Site.Params.comment "utterances"}}
{{ partial "utterances.html" . }}
{{ end }}
{{ partial "comment.html" . }}
{{ end }}
{{ end }}

View file