split head partial
authorDan Allen <dan@opendevise.com>
Tue, 6 Feb 2018 08:35:31 +0000 (01:35 -0700)
committerDan Allen <dan@opendevise.com>
Tue, 6 Feb 2018 08:35:31 +0000 (01:35 -0700)
- split head partial into head-meta and head-scripts
- consolidate gtags script

src/partials/head-meta.hbs [new file with mode: 0644]
src/partials/head-scripts.hbs [new file with mode: 0644]
src/partials/head.hbs

diff --git a/src/partials/head-meta.hbs b/src/partials/head-meta.hbs
new file mode 100644 (file)
index 0000000..541516c
--- /dev/null
@@ -0,0 +1 @@
+{{! Add additional meta tags here}}
diff --git a/src/partials/head-scripts.hbs b/src/partials/head-scripts.hbs
new file mode 100644 (file)
index 0000000..9e7c6ce
--- /dev/null
@@ -0,0 +1,6 @@
+{{#if site.keys.googleAnalytics}}
+{{#with site.keys.googleAnalytics}}
+    <script async src="https://www.googletagmanager.com/gtag/js?id={{this}}"></script>
+    <script>function gtag(){$gtag.push(arguments)}$gtag=window.dataLayer||[],gtag("js",new Date),gtag("config","{{this}}");</script>
+{{/with}}
+{{/if}}
index e64c140..b4ee621 100644 (file)
@@ -1,9 +1,2 @@
-{{#if site.keys.googleAnalytics}}
-<script async src="https://www.googletagmanager.com/gtag/js?id={{site.keys.googleAnalytics}}"></script>
-<script>
-window.dataLayer=window.dataLayer||[];
-function gtag(){dataLayer.push(arguments);}
-gtag('js',new Date());
-gtag('config','{{site.keys.googleAnalytics}}');
-</script>
-{{/if}}
+{{> head-meta}}
+{{> head-scripts}}