add custom comment
This commit is contained in:
parent
5a2a7cc35a
commit
36ce31b835
3 changed files with 20 additions and 13 deletions
17
exampleSite/layouts/partials/comment.html
Normal file
17
exampleSite/layouts/partials/comment.html
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<script>
|
||||||
|
const repo = '{{ .Site.Params.utterances.repo }}'
|
||||||
|
const issueTerm = '{{ .Site.Params.utterances.issueTerm }}'
|
||||||
|
const theme = localStorage.theme ? `github-${localStorage.theme}` : 'preferred-color-scheme';
|
||||||
|
|
||||||
|
const script = document.createElement('script')
|
||||||
|
script.src = 'https://utteranc.es/client.js'
|
||||||
|
script.async = true
|
||||||
|
script.crossOrigin = 'anonymous'
|
||||||
|
|
||||||
|
script.setAttribute('repo', repo)
|
||||||
|
script.setAttribute('issue-term', issueTerm)
|
||||||
|
script.setAttribute('theme', theme)
|
||||||
|
script.setAttribute('label', 'comment')
|
||||||
|
|
||||||
|
document.querySelector('main').appendChild(script)
|
||||||
|
</script>
|
|
@ -5,9 +5,9 @@
|
||||||
<h1 class="mt-6 mb-6">{{ .Title }}</h1>
|
<h1 class="mt-6 mb-6">{{ .Title }}</h1>
|
||||||
<div class="mb-3 text-xs flex justify-between sm:flex-col">
|
<div class="mb-3 text-xs flex justify-between sm:flex-col">
|
||||||
<div>
|
<div>
|
||||||
{{ if .Site.Params.displayDate }}
|
{{ if .Site.Params.displayDate }}
|
||||||
Posted at — {{ dateFormat .Site.Params.timeformat .Date }}
|
Posted at — {{ dateFormat .Site.Params.timeformat .Date }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if .Draft }}
|
{{ if .Draft }}
|
||||||
<span class="ml-3 minima-tag">
|
<span class="ml-3 minima-tag">
|
||||||
DRAFT
|
DRAFT
|
||||||
|
@ -37,16 +37,6 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if or .Params.comment (and .Site.Params.commentOnAllPosts (ne .Params.comment false)) }}
|
{{ if or .Params.comment (and .Site.Params.commentOnAllPosts (ne .Params.comment false)) }}
|
||||||
{{ if eq .Site.Params.comment "disqus"}}
|
{{ partial "comment.html" . }}
|
||||||
{{ partial "disqus.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if eq .Site.Params.comment "ovo"}}
|
|
||||||
{{ partial "ovo.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if eq .Site.Params.comment "utterances"}}
|
|
||||||
{{ partial "utterances.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
0
layouts/partials/comment.html
Normal file
0
layouts/partials/comment.html
Normal file
Loading…
Add table
Add a link
Reference in a new issue