Add utteranc comment plugin (#465)

* add comment plugin utteranc(save message to github issue)

config.yml
    # Enable comment feature. There, should be only one of them.
    comment:
      enable: true
      utteranc:
        repo: ormissia/ormissia.github.io
        issueTerm: title
        theme: github-light

* Update utteranc.html
This commit is contained in:
安红豆 2021-11-19 01:17:46 +08:00 committed by GitHub
parent 3cd9c910f7
commit 4e029b7de8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View file

@ -165,6 +165,9 @@
<!-- Add valine -->
{{ else if .valine }}
{{ partial "valine.html" . }}
<!-- Add utteranc -->
{{ else if .utteranc }}
{{ partial "utteranc.html" . }}
{{ end }}
{{ end }}
{{ end }}

View file

@ -0,0 +1,22 @@
{{ $repo := site.Params.features.comment.utteranc.repo }}
{{ $issueTerm := site.Params.features.comment.utteranc.issueTerm }}
{{ $theme := site.Params.features.comment.utteranc.theme }}
<div id="utteranc_thread"></div>
<div id="comments" class="comments">
<div id="comments-container"></div>
</div>
<script type="text/javascript">
(function() {
var utterances = document.createElement('script');
utterances.type = 'text/javascript';
utterances.async = true;
utterances.setAttribute('repo','{{ $repo }}')
utterances.setAttribute('issue-term','{{ $issueTerm }}')
utterances.setAttribute('theme','{{ $theme }}')
utterances.crossorigin = 'anonymous';
utterances.src = 'https://utteranc.es/client.js';
document.getElementById('comments-container').appendChild(utterances);
})();
</script>