gitalk.html 1.1 KB

123456789101112131415161718192021222324252627282930
  1. {{- with .Site.Params.comments.gitalk -}}
  2. <div id="gitalk-container"></div>
  3. <link
  4. rel="stylesheet"
  5. href="https://cdn.jsdelivr.net/npm/gitalk@1.7.2/dist/gitalk.css"
  6. />
  7. <script src="https://cdn.jsdelivr.net/npm/gitalk@1.7.2/dist/gitalk.min.js"></script>
  8. <script src="https://cdn.jsdelivr.net/npm/blueimp-md5@2.18.0/js/md5.min.js"></script>
  9. <script>
  10. const gitalk = new Gitalk({
  11. clientID: "{{- .clientID -}}",
  12. clientSecret: "{{- .clientSecret -}}",
  13. repo: "{{- .repo -}}",
  14. owner: "{{- .owner -}}",
  15. admin: ["{{- .admin -}}"],
  16. distractionFreeMode: false, // Facebook-like distraction free mode
  17. id: md5(location.pathname), // Max Location.pathname Legth:75 https://github.com/gitalk/gitalk/issues/102
  18. });
  19. (function () {
  20. if (
  21. ["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1
  22. ) {
  23. document.getElementById("gitalk-container").innerHTML =
  24. "Gitalk comments not available by default when the website is previewed locally.";
  25. return;
  26. }
  27. gitalk.render("gitalk-container");
  28. })();
  29. </script>
  30. {{ end }}