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:
authorMike Bergeron <shortword@users.noreply.github.com>2018-07-04 15:29:28 +0300
committerCurtis Timson <curt@live.co.uk>2018-07-04 15:29:28 +0300
commit10125d8fe1dae8b95ba3df96c419a369fac3eac5 (patch)
tree1003b724134796b2d95128664340ab48dec8d3b3
parent48582c4870a5fc4ff811b2b50ee938365a2d6d21 (diff)
Use Hugo's internal templates for Google Analytics (GA) (#36)3.0.0
* Use Hugo's internal templates for Google Analytics (GA) This commit does the following: * Removes a hardcoded Google Analytics ID * Converts the layout to use Hugo's internal GA teamplate * Removes the configuration items from the example site * Adds a section to the README about what internal templates are supported. For more info about the GA internal template, see this URL: https://gohugo.io/templates/internal/#configure-google-analytics Signed-off-by: Michael Bergeron <mikeb.code@gmail.com> * Add Google Analytics config into exampleSite * Add google analytics template to single.html * Bump version to 3.0.0 Breaking change based on google analytics configuration
-rw-r--r--README.md6
-rw-r--r--exampleSite/config-prod.toml2
-rw-r--r--exampleSite/config.toml2
-rw-r--r--layouts/_default/single.html3
-rw-r--r--layouts/index.html1
-rw-r--r--layouts/partials/scripts/googleanalytics.html11
-rw-r--r--layouts/partials/scripts/index.html1
-rw-r--r--package-lock.json2
-rw-r--r--package.json2
9 files changed, 13 insertions, 17 deletions
diff --git a/README.md b/README.md
index 3e31094..fbbe817 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,12 @@ See the demo's configuration as an example:
https://github.com/curttimson/hugo-theme-massively/blob/master/exampleSite/config-prod.toml
+#### Hugo Internal Templates
+
+The theme currently also supports the following ["internal templates" supplied by Hugo](https://gohugo.io/templates/internal/)
+
+ - [Google Analytics](https://gohugo.io/templates/internal/#configure-google-analytics)
+
### Cover Image
The cover image URL is hard-coded, therefore to replace this add an image to the following location in your Hugo application:
diff --git a/exampleSite/config-prod.toml b/exampleSite/config-prod.toml
index f7b7c87..1ddd58e 100644
--- a/exampleSite/config-prod.toml
+++ b/exampleSite/config-prod.toml
@@ -2,6 +2,7 @@ languageCode = "en-us"
title = "Massively"
baseURL = "https://hugo-theme-massively.netlify.com/"
theme = "../.."
+googleanalytics = "UA-113904582-4"
# [params]
# set below parameter to define a favicon
@@ -14,7 +15,6 @@ theme = "../.."
# featuredpost = "true"
[params.settings]
- googleanalytics = "UA-113904582-4"
disqus = "hugo-massively"
[languages]
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 4e4cbd0..902552c 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -2,6 +2,7 @@ languageCode = "en-us"
title = "Massively"
baseURL = "http://localhost:1313/"
theme = "../.."
+googleanalytics = "UA-113904582-3"
# [params]
# set below parameter to define a favicon
@@ -14,7 +15,6 @@ theme = "../.."
# featuredpost = "true"
[params.settings]
- googleanalytics = "UA-113904582-3"
disqus = "hugo-massively"
[languages]
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index f1b3f27..5860e0b 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -36,7 +36,8 @@
{{ partial "footer/index" . }}
{{ partial "copyright" . }}
- </div>
+ </div>
+ {{ template "_internal/google_analytics.html" . }}
{{ partial "scripts/index" . }}
</body>
</html>
diff --git a/layouts/index.html b/layouts/index.html
index b45fb1c..ae90e4d 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -60,6 +60,7 @@
{{ partial "copyright" . }}
</div>
+ {{ template "_internal/google_analytics.html" . }}
{{ partial "scripts/index" . }}
</body>
diff --git a/layouts/partials/scripts/googleanalytics.html b/layouts/partials/scripts/googleanalytics.html
deleted file mode 100644
index 98a3c47..0000000
--- a/layouts/partials/scripts/googleanalytics.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{{ 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/index.html b/layouts/partials/scripts/index.html
index 92c8ed9..2c4ef29 100644
--- a/layouts/partials/scripts/index.html
+++ b/layouts/partials/scripts/index.html
@@ -6,5 +6,4 @@
<script src='{{ "assets/js/util.js" | relURL }}'></script>
<script src='{{ "assets/js/main.js" | relURL }}'></script>
-{{ partial "scripts/googleanalytics" . }}
{{ partial "scripts/disqus" . }}
diff --git a/package-lock.json b/package-lock.json
index d4fb0aa..983a30a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,5 +1,5 @@
{
"name": "hugo-theme-massively",
- "version": "2.2.0",
+ "version": "2.2.2",
"lockfileVersion": 1
}
diff --git a/package.json b/package.json
index b0babcc..db589b9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "hugo-theme-massively",
- "version": "2.2.2",
+ "version": "3.0.0",
"description": "HTML5 UP theme Massively for Hugo",
"main": "index.js",
"scripts": {