| assets/js/coder.js | ●●●●● patch | view | raw | blame | history | |
| docs/configurations.md | ●●●●● patch | view | raw | blame | history | |
| layouts/partials/posts/giscus.html | ●●●●● patch | view | raw | blame | history | |
| layouts/posts/single.html | ●●●●● patch | view | raw | blame | history |
assets/js/coder.js
@@ -75,6 +75,17 @@ }) } function sendMessage(message) { const iframe = document.querySelector('iframe.giscus-frame'); if (!iframe) return; iframe.contentWindow.postMessage({ giscus: message }, 'https://giscus.app'); } sendMessage({ setConfig: { theme: theme, }, }); // Create and send event const event = new Event('themeChanged'); docs/configurations.md
@@ -14,6 +14,7 @@ * [Disqus](#disqus) * [Commento](#commento) * [Utterances](#utterances) * [Giscus](#giscus) * [Theme Parameters](#theme-parameters) * [Social Icons Configuration](#social-icons-configuration) * [Menu Items Configurations](#menu-items-configurations) @@ -39,6 +40,7 @@ * [Disqus](https://disqus.com/) * [Commento](https://commento.io/) * [Utterances](https://utteranc.es/) * [Giscus](https://giscus.app/) ### Analytics @@ -123,6 +125,25 @@ theme = "" # https://utteranc.es/#heading-theme ``` #### Giscus ```toml [params.giscus] # https://giscus.app repo = "" repoID = "" category = "" categoryID = "" mapping = "" term = "" strict = "" reactionsEnabled = "" emitMetadata = "" inputPosition = "" theme = "" lang = "" loading = "" ``` ## Theme Parameters These are all the parameters used by `hugo-coder` theme. layouts/partials/posts/giscus.html
New file @@ -0,0 +1,33 @@ {{- if isset .Site.Params "giscus" -}} {{- if and (isset .Site.Params.giscus "repo") (not (eq .Site.Params.giscus.repo "" )) (eq (.Params.disableComments | default false) false) -}} <div class="comments"> <script> let getTheme = window.localStorage && window.localStorage.getItem("colorscheme"); getTheme = getTheme == null ? '{{$.Site.Params.giscus.theme}}' : getTheme; let s = document.createElement('script'); s.src = 'https://giscus.app/client.js'; s.setAttribute('data-repo', '{{ .Site.Params.giscus.repo }}'); s.setAttribute('data-repo-id', '{{ .Site.Params.giscus.repoID }}'); s.setAttribute('data-category', '{{ .Site.Params.giscus.category }}'); s.setAttribute('data-category-id', '{{ .Site.Params.giscus.categoryID }}'); s.setAttribute('data-mapping', '{{ default "pathname" .Site.Params.giscus.mapping }}'); s.setAttribute('data-term', '{{ .Site.Params.giscus.term }}'); s.setAttribute('data-strict', '{{ default "0" .Site.Params.giscus.strict }}'); s.setAttribute('data-reactions-enabled', '{{ default "1" .Site.Params.giscus.reactionsEnabled }}'); s.setAttribute('data-emit-metadata', '{{ default "0" .Site.Params.giscus.emitMetadata }}'); s.setAttribute('data-input-position', '{{ default "bottom" .Site.Params.giscus.inputPosition }}'); s.setAttribute('data-theme', getTheme); s.setAttribute('data-lang', '{{ default "en" .Site.Params.giscus.lang }}'); s.setAttribute('data-loading', '{{ .Site.Params.giscus.loading }}'); s.setAttribute('crossorigin', 'anonymous'); s.setAttribute('async', ''); document.querySelector('div.comments').innerHTML = ''; document.querySelector('div.comments').appendChild(s); </script> </div> {{- end -}} {{- end -}} layouts/posts/single.html
@@ -44,6 +44,7 @@ {{ partial "posts/disqus.html" . }} {{ partial "posts/commento.html" . }} {{ partial "posts/utterances.html" . }} {{ partial "posts/giscus.html" . }} </footer> </article>