disqus.html 824 B

123456789101112131415161718
  1. <div id="disqus_thread"></div>
  2. <script>
  3. let disqus_config = function () {
  4. {{with .Params.disqus_identifier }}this.page.identifier = '{{ . }}';{{end}}
  5. {{with .Params.disqus_title }}this.page.title = '{{ . }}';{{end}}
  6. {{with .Params.disqus_url }}this.page.url = '{{ . | html }}';{{end}}
  7. };
  8. (function () {
  9. if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) {
  10. document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.';
  11. return;
  12. }
  13. var d = document, s = d.createElement('script'); s.async = true;
  14. s.src = 'https://' + '{{ .Site.Params.disqus_shortname }}' + '.disqus.com/embed.js';
  15. s.setAttribute('data-timestamp', +new Date());
  16. (d.head || d.body).appendChild(s);
  17. }) ();
  18. </script>