blob: 66858f9c03c3aafb85a35125c54c55c7ab939549 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
{{ if .IsPage }}
{{ if and (.Site.Params.comment.disqus.enable) (not (.Site.Config.Privacy.Disqus.Disable)) }}
<div id="disqus_thread">
<noscript>Please enable JavaScript to view the comments powered by Disqus.</noscript>
</div>
<script type="text/javascript">
var disqus_config = function() {
this.page.url = '{{ .Permalink }}';
{{ if .Params.disqusIdentifier }}
this.page.identifier = '{{ .Params.disqusIdentifier }}';
{{ else }}
this.page.identifier = '{{ .RelPermalink }}'
{{ end }}
};
(function() {
// Don't ever inject Disqus on localhost--it creates unwanted
// discussions from 'localhost:1313' on your Disqus account...
if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) {
document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.';
return;
}
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
var disqus_shortname = '{{ .Site.DisqusShortname }}';
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
{{ else if .Site.Params.comment.gitalk.enable }}
<div id="gitalk">
<noscript>Please enable JavaScript to view the comments powered by Gitalk.</noscript>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gitalk/1.7.2/gitalk.min.js" integrity="sha512-EcTCcXV46teiNwe0VcnM5A038tcY+BaQYO4nW6Gh2i7v4/HjBVg7xx3+JBLl9WofDds//INJAiEGAtdgr8PWyA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script type="text/javascript">
(function() {
if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) {
document.getElementById('gitalk').innerHTML = 'Gitalk comments not available by default when the website is previewed locally.';
return;
}
new Gitalk({
clientID: '{{ .Site.Params.comment.gitalk.clientId }}',
clientSecret: '{{ .Site.Params.comment.gitalk.clientSecret }}',
repo: '{{ .Site.Params.comment.gitalk.repo }}',
owner: '{{ .Site.Params.comment.gitalk.owner }}',
admin: ['{{ .Site.Params.comment.gitalk.owner }}'],
id: '{{ .RelPermalink }}',
...{{ .Site.Params.comment.gitalk.options | jsonify | safeJS }}
}).render('gitalk')
})()
</script>
{{ end }}
{{ end }}
|