From 758dc250c2a8dd0b830ef227a2056157f7934ac4 Mon Sep 17 00:00:00 2001 From: gleb-kun <94681073+gleb-kun@users.noreply.github.com> Date: Thu, 27 Feb 2025 21:53:48 +0300 Subject: [PATCH] fix(gitalk): refactor local Gitalk loading check for improved readability --- layouts/partials/comments/provider/gitalk.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/layouts/partials/comments/provider/gitalk.html b/layouts/partials/comments/provider/gitalk.html index 54bfcba..ac77fc6 100644 --- a/layouts/partials/comments/provider/gitalk.html +++ b/layouts/partials/comments/provider/gitalk.html @@ -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;