mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-30 04:23:30 +08:00
25 lines
893 B
HTML
25 lines
893 B
HTML
{{- 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 }}
|