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:
parent
3cd9c910f7
commit
4e029b7de8
2 changed files with 25 additions and 0 deletions
|
@ -165,6 +165,9 @@
|
|||
<!-- Add valine -->
|
||||
{{ else if .valine }}
|
||||
{{ partial "valine.html" . }}
|
||||
<!-- Add utteranc -->
|
||||
{{ else if .utteranc }}
|
||||
{{ partial "utteranc.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
22
layouts/partials/utteranc.html
Normal file
22
layouts/partials/utteranc.html
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue