Merge pull request #139 from pobtastic/patch-2

Use Hugo built-in GA
This commit is contained in:
MeiK
2024-03-19 15:51:56 +08:00
committed by GitHub
3 changed files with 9 additions and 14 deletions

View File

@@ -144,7 +144,6 @@ baseURL = "https://meik2333.com/"
languageCode = "zh-cn"
title = "MeiK's blog"
theme = "github-style"
googleAnalytics = "UA-123456-789"
pygmentsCodeFences = true
pygmentsUseClasses = true
@@ -193,6 +192,10 @@ pygmentsUseClasses = true
[frontmatter]
lastmod = ["lastmod", ":fileModTime", ":default"]
[services]
[services.googleAnalytics]
ID = "UA-123456-789"
```
## Support collapsible block

View File

@@ -2,7 +2,6 @@ baseURL = "https://meik2333.com/"
languageCode = "zh-cn"
title = "MeiK's blog"
theme = "github-style"
googleAnalytics = "UA-123456-789"
pygmentsCodeFences = true
pygmentsUseClasses = true
@@ -50,3 +49,7 @@ pygmentsUseClasses = true
[frontmatter]
lastmod = ["lastmod", ":fileModTime", ":default"]
[services]
[services.googleAnalytics]
ID = "UA-123456-789"

View File

@@ -42,16 +42,5 @@
<!-- Google Analytics -->
{{ if eq (getenv "HUGO_ENV") "production"}}
{{ with .Site.GoogleAnalytics }}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script>
<script>
if (navigator.doNotTrack !== '1') {
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '{{ . }}');
}
</script>
{{ template "_internal/google_analytics.html" . }}
{{ end }}
{{ end }}