refactor(comments): use includes instead of indexOf to improve readability (#1128)

* fix(disqusjs): refactor local DisqusJS loading check for improved readability

* fix(gitalk): refactor local Gitalk loading check for improved readability
This commit is contained in:
Gleb A.
2025-05-21 12:52:47 +02:00
committed by GitHub
parent d9acd77015
commit 47832083d8
2 changed files with 10 additions and 5 deletions
@@ -18,9 +18,10 @@
proxy: {{- .proxy -}},
});
(function () {
if (
["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1
) {
const excludedHosts = ["localhost", "127.0.0.1"];
const hostname = window.location.hostname;
if (excludedHosts.includes(hostname)) {
document.getElementById("gitalk-container").innerHTML =
"Gitalk comments not available by default when the website is previewed locally.";
return;