fix(gitalk): refactor local Gitalk loading check for improved readability

This commit is contained in:
gleb-kun 2025-02-27 21:53:48 +03:00
parent 1950a66cd2
commit 758dc250c2

View File

@ -18,9 +18,10 @@
proxy: {{- .proxy -}}, proxy: {{- .proxy -}},
}); });
(function () { (function () {
if ( const excludedHosts = ["localhost", "127.0.0.1"];
["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1 const hostname = window.location.hostname;
) {
if (excludedHosts.includes(hostname)) {
document.getElementById("gitalk-container").innerHTML = document.getElementById("gitalk-container").innerHTML =
"Gitalk comments not available by default when the website is previewed locally."; "Gitalk comments not available by default when the website is previewed locally.";
return; return;