disqus.html 1.1 KB

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