| 1 |
{{- $pc := .Site.Config.Privacy.Disqus -}} |
| 2 |
{{- if not $pc.Disable -}} |
| 3 |
{{ if .Site.Config.Services.Disqus.Shortname }}<div id="disqus_thread"></div> |
| 4 |
<script> |
| 5 |
window.disqus_config = function () { |
| 6 |
{{with .Params.disqus_identifier }}this.page.identifier = '{{ . }}';{{end}} |
| 7 |
{{with .Params.disqus_title }}this.page.title = '{{ . }}';{{end}} |
| 8 |
{{with .Params.disqus_url }}this.page.url = '{{ . | transform.HTMLEscape | safeURL }}';{{end}} |
| 9 |
}; |
| 10 |
(function() { |
| 11 |
if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) { |
| 12 |
document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.'; |
| 13 |
return; |
| 14 |
} |
| 15 |
var d = document, s = d.createElement('script'); s.async = true; |
| 16 |
s.src = '//' + {{ .Site.Config.Services.Disqus.Shortname }} + '.disqus.com/embed.js'; |
| 17 |
s.setAttribute('data-timestamp', +new Date()); |
| 18 |
(d.head || d.body).appendChild(s); |
| 19 |
})(); |
| 20 |
</script> |
| 21 |
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> |
| 22 |
<a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a> |
| 23 |
{{ end }} |
| 24 |
{{- end -}} |