diff options
author | Gökmen Görgen <gkmngrgn@gmail.com> | 2019-09-13 00:10:11 +0300 |
---|---|---|
committer | Gökmen Görgen <gkmngrgn@gmail.com> | 2019-09-13 00:13:29 +0300 |
commit | 08808e52c670157319a75462f686759d31fdd2ed (patch) | |
tree | 5e31e886d4a50e6828040b5459c20de3476d2d0d | |
parent | bbcacf529f80e71bb980e362bc1ab66431185834 (diff) |
Fix "lates posts" section for hugo v0.58.+. #15
It's a backward compatible solution. Tested in:
- hugo_0.58.1_Linux-64bit.deb
- hugo_0.58.0_Linux-64bit.deb
- hugo_0.40_Linux-64bit.deb
- hugo_0.57.2_Linux-64bit.deb
-rw-r--r-- | layouts/index.html | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/layouts/index.html b/layouts/index.html index 1df8b4a..a5719d2 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -24,11 +24,12 @@ {{ if isset .Site.Params "latestpostcount" }} <div class="mx-0 mx-md-4 posts"> - {{ $nbPosts := len (where .Data.Pages "Section" "blog") }} + {{ $nbPosts := len (where .Site.RegularPages "Section" "blog") }} + {{ if gt $nbPosts 0 }} <div class="page-heading">{{ i18n "latest_posts" }}</div> <ul class="px-0"> - {{ range (first .Site.Params.latestpostcount (where .Pages "Section" "blog")).GroupByDate "Jan, 2006" "desc" }} + {{ range (first .Site.Params.latestpostcount (where .Site.RegularPages "Section" "blog")).GroupByDate "Jan, 2006" "desc" }} <li class="groupby">{{ .Key }}</li> {{ range sort .Pages "Date" "desc" }} {{ partial "list" . }} |