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
This commit is contained in:
Aaron Schlesinger
2020-05-17 02:13:03 -07:00
committed by GitHub
parent 9ea1d79fb2
commit 038d6623a0
2 changed files with 6 additions and 2 deletions

View File

@@ -10,11 +10,13 @@
{{ if isset .Site.Params "latestpostcount" }}
<div class="posts">
{{ $nbPosts := len (where .Data.Pages "Section" "blog") }}
{{ $blogPosts := (where .Site.RegularPages "Section" "blog") }}
{{ $nbPosts := len $blogPosts }}
{{ if gt $nbPosts 0 }}
<div class="page-heading">Latest posts</div>
<ul>
{{ range (first .Site.Params.latestpostcount (where .Pages "Section" "blog")).GroupByDate "Jan, 2006" "desc" }}
{{ range (first .Site.Params.latestpostcount $blogPosts).GroupByDate "Jan, 2006" "desc" }}
<li class="groupby">{{ .Key }}</li>
{{ range sort .Pages "Date" "desc" }}
{{ partial "li.html" . }}

View File

@@ -41,7 +41,9 @@ fathom('trackPageview');
<!-- / Fathom -->
{{ end }}
{{ if .Site.Params.googleAnalyticsEnabled }}
{{ template "_internal/google_analytics_async.html" . }}
{{ end }}
<script>
window.onload = function() {