Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/curttimson/hugo-theme-massively.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--exampleSite/config.toml5
-rw-r--r--layouts/_default/single.html2
-rw-r--r--layouts/index.html2
-rw-r--r--layouts/partials/scripts/googleanalytics.html11
-rw-r--r--layouts/partials/scripts/index.html (renamed from layouts/partials/scripts.html)4
5 files changed, 20 insertions, 4 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 8e6d3bc..198b0cd 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -4,4 +4,7 @@ baseURL = "http://localhost:1313/"
theme = "../.."
[params.posts]
- foldername = "post" \ No newline at end of file
+ foldername = "post"
+
+[params.settings]
+ googleanalytics = "UA-113904582-3" \ No newline at end of file
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 298baf0..12c9d8c 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -31,6 +31,6 @@
{{ partial "copyright" . }}
</div>
- {{ partial "scripts" . }}
+ {{ partial "scripts/index" . }}
</body>
</html> \ No newline at end of file
diff --git a/layouts/index.html b/layouts/index.html
index 3b2978d..bbc3c4f 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -62,7 +62,7 @@
{{ partial "copyright" . }}
</div>
- {{ partial "scripts" . }}
+ {{ partial "scripts/index" . }}
</body>
</html> \ No newline at end of file
diff --git a/layouts/partials/scripts/googleanalytics.html b/layouts/partials/scripts/googleanalytics.html
new file mode 100644
index 0000000..98a3c47
--- /dev/null
+++ b/layouts/partials/scripts/googleanalytics.html
@@ -0,0 +1,11 @@
+{{ if .Site.Params.Settings.googleanalytics }}
+<!-- Global site tag (gtag.js) - Google Analytics -->
+<script async src="https://www.googletagmanager.com/gtag/js?id=UA-113904582-1"></script>
+<script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag(){dataLayer.push(arguments);}
+ gtag('js', new Date());
+
+ gtag('config', {{ .Site.Params.Settings.googleanalytics }});
+</script>
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts/index.html
index 55cf570..491a583 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts/index.html
@@ -4,4 +4,6 @@
<script src="{{ .Site.BaseURL }}assets/js/jquery.scrolly.min.js"></script>
<script src="{{ .Site.BaseURL }}assets/js/skel.min.js"></script>
<script src="{{ .Site.BaseURL }}assets/js/util.js"></script>
-<script src="{{ .Site.BaseURL }}assets/js/main.js"></script> \ No newline at end of file
+<script src="{{ .Site.BaseURL }}assets/js/main.js"></script>
+
+{{ partial "scripts/googleanalytics.html" . }}