diff options
author | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-11-03 20:08:36 +0300 |
---|---|---|
committer | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-11-03 20:08:36 +0300 |
commit | 59c7d4567380d1a9c80e96eb958fdbdd512ce006 (patch) | |
tree | 65410cfc10dbc7d060ec23be110662d9b7f6b0e9 /themes/hugo-theme-stack/layouts/partials/comments/provider/gitalk.html |
новая жизнь блога
Diffstat (limited to 'themes/hugo-theme-stack/layouts/partials/comments/provider/gitalk.html')
-rw-r--r-- | themes/hugo-theme-stack/layouts/partials/comments/provider/gitalk.html | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/themes/hugo-theme-stack/layouts/partials/comments/provider/gitalk.html b/themes/hugo-theme-stack/layouts/partials/comments/provider/gitalk.html new file mode 100644 index 0000000..54bfcba --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/comments/provider/gitalk.html @@ -0,0 +1,31 @@ +{{- with .Site.Params.comments.gitalk -}} +<div id="gitalk-container"></div> +<link + rel="stylesheet" + href="https://cdn.jsdelivr.net/npm/gitalk@1.7.2/dist/gitalk.css" +/> +<script src="https://cdn.jsdelivr.net/npm/gitalk@1.7.2/dist/gitalk.min.js"></script> +<script src="https://cdn.jsdelivr.net/npm/blueimp-md5@2.18.0/js/md5.min.js"></script> +<script> + const gitalk = new Gitalk({ + clientID: "{{- .clientID -}}", + clientSecret: "{{- .clientSecret -}}", + repo: "{{- .repo -}}", + owner: "{{- .owner -}}", + admin: ["{{- .admin -}}"], + distractionFreeMode: false, // Facebook-like distraction free mode + id: md5(location.pathname), // Max Location.pathname Legth:75 https://github.com/gitalk/gitalk/issues/102 + proxy: {{- .proxy -}}, + }); + (function () { + if ( + ["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1 + ) { + document.getElementById("gitalk-container").innerHTML = + "Gitalk comments not available by default when the website is previewed locally."; + return; + } + gitalk.render("gitalk-container"); + })(); +</script> +{{ end }} |