From b4289bcbd43c6fc1770412470f16eda4fe4c9dcc Mon Sep 17 00:00:00 2001 From: Memory Clutter Date: Sat, 5 Nov 2022 15:43:57 +0300 Subject: [PATCH] Added support for comment label customization --- exampleSite/config.toml | 1 + layouts/partials/utterances.html | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 69380ba..7c8fa52 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -62,6 +62,7 @@ shortname = "hugo-minima" [params.utterances] repo = "mivinci/hugo-theme-minima" issueTerm = "pathname" +label = "comment" # **deprecated** # OvO is a comment plugin written by the author of Minima. diff --git a/layouts/partials/utterances.html b/layouts/partials/utterances.html index d1093e2..9b05863 100644 --- a/layouts/partials/utterances.html +++ b/layouts/partials/utterances.html @@ -2,6 +2,7 @@ const repo = '{{ .Site.Params.utterances.repo }}' const issueTerm = '{{ .Site.Params.utterances.issueTerm }}' const theme = localStorage.theme ? `github-${localStorage.theme}` : 'preferred-color-scheme'; + const label = '{{ .Site.Params.utterances.label }}' const script = document.createElement('script') script.src = 'https://utteranc.es/client.js' @@ -11,7 +12,7 @@ script.setAttribute('repo', repo) script.setAttribute('issue-term', issueTerm) script.setAttribute('theme', theme) - script.setAttribute('label', 'comment') + script.setAttribute('label', label ? label : 'comment') document.querySelector('main').appendChild(script)