Add gittalk

This commit is contained in:
Cookiekira 2021-09-12 17:37:01 +08:00
parent 5693c4bf7a
commit dd285cd848
8 changed files with 34 additions and 1 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -51,7 +51,7 @@ params:
comments: comments:
enabled: true enabled: true
provider: disqus provider: gittalk
disqusjs: disqusjs:
shortname: shortname:
@ -111,6 +111,14 @@ params:
reactionsEnabled: 1 reactionsEnabled: 1
emitMetadata: 0 emitMetadata: 0
gittalk:
owner: 'Cookiekira'
admin: 'Cookiekira'
repo: 'gitment-comments'
clientID: 'c2acde8bec65d6540c9a'
clientSecret: 'cf8cdd3828f4a3e901389c3b7f3d331974644f88'
id: location.pathname, # Ensure uniqueness and length less than 50
widgets: widgets:
enabled: enabled:
- search - search

BIN
layouts/.DS_Store vendored Normal file

Binary file not shown.

BIN
layouts/_default/.DS_Store vendored Normal file

Binary file not shown.

BIN
layouts/partials/.DS_Store vendored Normal file

Binary file not shown.

BIN
layouts/partials/comments/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
{{- with .Site.Params.comments.gittalk -}}
<div id="gitalk-container"></div>
<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
<script>
const gitalk = new Gitalk({
clientID: '{{ .clientID }}',
clientSecret: '{{ .clientSecret }}',
repo: '{{ .Gitalk.repo }}',
owner: '{{ .owner }}',
admin: ['{{ .owner }}'],
id: location.pathname, // Ensure uniqueness and length less than 50
distractionFreeMode: false // Facebook-like distraction free mode
});
(function() {
if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) {
document.getElementById('gitalk-container').innerHTML = 'Gitalk comments not available by default when the website is previewed locally.';
return;
}
gitalk.render('gitalk-container');
})();
</script>
{{ end }}

View File

@ -18,6 +18,7 @@ features = [
"darkmode", "darkmode",
"table of contents", "table of contents",
"search", "search",
"gitalk",
] ]
min_version = "0.78.0" min_version = "0.78.0"