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 }}