mirror of
https://github.com/Noettore/cocoa-eh-hugo-theme.git
synced 2025-10-15 11:46:41 +02:00
Fix the case where latestpostcount is missing from configuration.
This commit is contained in:

committed by
Alexis Tacnet

parent
80ddd50ee5
commit
a9a0b236d3
@@ -8,24 +8,26 @@
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="posts">
|
||||
{{ $nbPosts := len (where .Data.Pages "Section" "blog") }}
|
||||
{{ 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" }}
|
||||
<li class="groupby">{{ .Key }}</li>
|
||||
{{ range .Pages.ByPublishDate }}
|
||||
{{ partial "li.html" . }}
|
||||
{{ if isset .Site.Params "latestpostcount" }}
|
||||
<div class="posts">
|
||||
{{ $nbPosts := len (where .Data.Pages "Section" "blog") }}
|
||||
{{ 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" }}
|
||||
<li class="groupby">{{ .Key }}</li>
|
||||
{{ range .Pages.ByPublishDate }}
|
||||
{{ partial "li.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
{{ if gt $nbPosts .Site.Params.latestpostcount }}
|
||||
<a href="./blog/" class="see-more">See more ...</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
{{ if gt $nbPosts .Site.Params.latestpostcount }}
|
||||
<a href="./blog/" class="see-more">See more ...</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="best-posts">
|
||||
{{ $nbPosts := len (where .Data.Pages "Params.best" true) }}
|
||||
|
Reference in New Issue
Block a user