Merge pull request #33 from memclutter/utterances-label

Added support for comment label customization
This commit is contained in:
x 2022-11-06 12:18:56 +08:00 committed by GitHub
commit 6eff0335c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -62,6 +62,7 @@ shortname = "hugo-minima"
[params.utterances] [params.utterances]
repo = "mivinci/hugo-theme-minima" repo = "mivinci/hugo-theme-minima"
issueTerm = "pathname" issueTerm = "pathname"
label = "comment"
# **deprecated** # **deprecated**
# OvO is a comment plugin written by the author of Minima. # OvO is a comment plugin written by the author of Minima.

View file

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