hugo-theme-minima/layouts/partials/giscus.html

28 lines
No EOL
1.1 KiB
HTML

<script>
const repo = '{{ .Site.Params.giscus.repo }}'
const repoId = '{{ .Site.Params.giscus.repoId }}'
const category = '{{ .Site.Params.giscus.category }}'
const categoryId = '{{ .Site.Params.giscus.categoryId }}'
const mapping = '{{ .Site.Params.giscus.mapping }}'
const inputPosition = '{{ .Site.Params.giscus.inputPosition }}'
const theme = localStorage.theme || 'preferred-color-scheme';
const s = document.createElement('script')
s.src = 'https://giscus.app/client.js'
s.async = true
s.crossOrigin = 'anonymous'
s.setAttribute('data-repo', repo)
s.setAttribute('data-repo-id', repoId)
s.setAttribute('data-category', category)
s.setAttribute('data-category-id', categoryId)
s.setAttribute('data-mapping', mapping)
s.setAttribute('data-strict', "0")
s.setAttribute('data-reactions-enabled', "1")
s.setAttribute('data-emit-metadata', "0")
s.setAttribute('data-input-position', inputPosition)
s.setAttribute('data-theme', theme)
s.setAttribute('data-loading', "lazy")
s.setAttribute('data-lang', "en")
document.querySelector('main').appendChild(s)
</script>