From 038d6623a0c6b4404d1ba7cddfb718acdde38682 Mon Sep 17 00:00:00 2001
From: Aaron Schlesinger <70865+arschles@users.noreply.github.com>
Date: Sun, 17 May 2020 02:13:03 -0700
Subject: [PATCH] Adding the option to turn off Google Analytics & Fix Latest
Posts List (#144)
* adding option to turn off Google Analytics
* fixing the latest posts list
---
layouts/index.html | 6 ++++--
layouts/partials/footer_scripts.html | 2 ++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/layouts/index.html b/layouts/index.html
index 8fa2e38..e02c589 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -10,11 +10,13 @@
{{ if isset .Site.Params "latestpostcount" }}
- {{ $nbPosts := len (where .Data.Pages "Section" "blog") }}
+ {{ $blogPosts := (where .Site.RegularPages "Section" "blog") }}
+ {{ $nbPosts := len $blogPosts }}
{{ if gt $nbPosts 0 }}
Latest posts
- {{ range (first .Site.Params.latestpostcount (where .Pages "Section" "blog")).GroupByDate "Jan, 2006" "desc" }}
+
+ {{ range (first .Site.Params.latestpostcount $blogPosts).GroupByDate "Jan, 2006" "desc" }}
- {{ .Key }}
{{ range sort .Pages "Date" "desc" }}
{{ partial "li.html" . }}
diff --git a/layouts/partials/footer_scripts.html b/layouts/partials/footer_scripts.html
index 7ecbf68..d45776b 100644
--- a/layouts/partials/footer_scripts.html
+++ b/layouts/partials/footer_scripts.html
@@ -41,7 +41,9 @@ fathom('trackPageview');
{{ end }}
+{{ if .Site.Params.googleAnalyticsEnabled }}
{{ template "_internal/google_analytics_async.html" . }}
+{{ end }}