summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2024-12-13 09:03:54 +0800
committerEltrac <hi@guhub.cn>2024-12-13 09:03:54 +0800
commitc32bbef6f3a147c559863011fd683f98999c4d90 (patch)
tree98197c4ed33b6ee770db38af69c43783aea97a1a
parent4e9d8b02f2e971ce831428bac67eff64a27483b9 (diff)
fix: unwanted unmami count in localhost
-rw-r--r--themes/yinyang/layouts/partials/head.html7
-rw-r--r--themes/yinyang/layouts/partials/head/headscript.html (renamed from themes/yinyang/layouts/partials/head/seo.html)11
-rw-r--r--themes/yinyang/layouts/partials/scripts.html3
3 files changed, 13 insertions, 8 deletions
diff --git a/themes/yinyang/layouts/partials/head.html b/themes/yinyang/layouts/partials/head.html
index c1d28881..8ae6c46f 100644
--- a/themes/yinyang/layouts/partials/head.html
+++ b/themes/yinyang/layouts/partials/head.html
@@ -8,13 +8,10 @@
<meta property="og:url" content="{{ .Permalink }}" />
<link rel="canonical" href="{{ .Permalink }}" />
- <!-- SEO & Basic Meta Tags-->
- {{ partial "head/seo" . }}
{{ partial "head/siteinfo" . }}
-
- <!-- Stylesheets -->
{{ partial "head/css" . }}
+ {{ partial "head/headscript" . }}
<!-- Extra head -->
{{ .Site.Params.extraHead | safeHTML }}
-</head> \ No newline at end of file
+</head>
diff --git a/themes/yinyang/layouts/partials/head/seo.html b/themes/yinyang/layouts/partials/head/headscript.html
index 2d772d72..5f0c3cbe 100644
--- a/themes/yinyang/layouts/partials/head/seo.html
+++ b/themes/yinyang/layouts/partials/head/headscript.html
@@ -27,3 +27,14 @@
"keywords" : [ {{ if isset .Params "tags" }}{{ range .Params.tags }}"{{ . }}",{{ end }}{{ end }} ]
}
</script>
+
+<!-- Umami -->
+<script>
+ if (window.location.hostname !== 'localhost') {
+ const script = document.createElement('script');
+ script.defer = true;
+ script.src = 'https://cloud.umami.is/script.js';
+ script.dataset.websiteId = 'ae8c2619-56eb-4577-ac31-9dc6ea44bda7';
+ document.head.appendChild(script);
+ }
+</script>
diff --git a/themes/yinyang/layouts/partials/scripts.html b/themes/yinyang/layouts/partials/scripts.html
index 0624d766..a0823181 100644
--- a/themes/yinyang/layouts/partials/scripts.html
+++ b/themes/yinyang/layouts/partials/scripts.html
@@ -1,6 +1,3 @@
-<!-- Umami -->
-<script defer src="https://cloud.umami.is/script.js" data-website-id="ae8c2619-56eb-4577-ac31-9dc6ea44bda7"></script>
-
<!-- Swup -->
<script src="https://unpkg.com/swup@4"></script>
<script type="module">