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

github.com/thingsym/hugo-theme-techdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthingsym <thingsym@gmail.com>2019-10-06 10:10:54 +0300
committerthingsym <thingsym@gmail.com>2019-10-06 10:10:54 +0300
commitcacf1c352ec164695e0c96bc2042ace65e880d69 (patch)
tree920bd79c1f10dacb082dd38f2e4efe00b97cf517 /layouts
parent5a1f764cd37e425de1011c7ce996ad1153742c2b (diff)
perf: add prepend-body.html for Tag Manager noscript version
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html1
-rw-r--r--layouts/partials/prepend-body.html10
2 files changed, 11 insertions, 0 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 15d05da..e055800 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -5,6 +5,7 @@
{{- partial "custom-head.html" . -}}
</head>
<body>
+{{- partial "prepend-body.html" . -}}
<div class="container">
{{- partial "notification.html" . -}}
{{- partial "site-header.html" . -}}
diff --git a/layouts/partials/prepend-body.html b/layouts/partials/prepend-body.html
new file mode 100644
index 0000000..e3c7eac
--- /dev/null
+++ b/layouts/partials/prepend-body.html
@@ -0,0 +1,10 @@
+{{ if .Site.IsServer }}
+<!-- only production, not generate Google Analytics with Hugo’s built-in server -->
+{{ else }}
+{{- with .Site.Params.tag_manager_container_id -}}
+<!-- BEGIN: Tag Manager -->
+<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ . }}"
+height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
+<!-- END: Tag Manager -->
+{{- end -}}
+{{- end -}}