fix giscus and multilingual mode
This commit is contained in:
parent
0784b32a41
commit
1105d5e939
16 changed files with 424 additions and 211 deletions
|
@ -1,28 +1,18 @@
|
|||
<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>
|
||||
{{ $giscus := .Site.Params.comment.giscus }}
|
||||
<script
|
||||
src="https://giscus.app/client.js"
|
||||
data-repo="{{ $giscus.repo }}"
|
||||
data-repo-id="{{ $giscus.repoId }}"
|
||||
data-category="{{ $giscus.category }}"
|
||||
data-category-id="{{ $giscus.categoryId }}"
|
||||
data-mapping="{{ $giscus.mapping }}"
|
||||
data-strict="0"
|
||||
data-reactions-enabled="{{ cond $giscus.reactions 1 0 }}"
|
||||
data-emit-metadata="{{ cond $giscus.metadata 1 0 }}"
|
||||
data-input-position="{{ $giscus.inputPosition }}"
|
||||
data-theme="preferred_color_scheme"
|
||||
data-lang="en"
|
||||
data-loading="lazy"
|
||||
crossorigin="anonymous"
|
||||
async>
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue