mirror of
https://github.com/Noettore/cocoa-eh-hugo-theme.git
synced 2025-10-15 19:56:41 +02:00
Changed blog view on home page.
* Removed date grouping of recent blog posts. * Added a paramter to specify how many posts to show.
This commit is contained in:

committed by
Alexis Tacnet

parent
436ab5acb2
commit
e02bf39694
@@ -22,6 +22,7 @@ logofile = "img/logo.png"
|
|||||||
faviconfile = "img/logo.png"
|
faviconfile = "img/logo.png"
|
||||||
highlightjs = true
|
highlightjs = true
|
||||||
progressively = true
|
progressively = true
|
||||||
|
latestpostcount = 10
|
||||||
lang = "en"
|
lang = "en"
|
||||||
github = "example"
|
github = "example"
|
||||||
email = "you@example.com"
|
email = "you@example.com"
|
||||||
|
@@ -8,22 +8,19 @@
|
|||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ $nbPosts := len (where .Data.Pages "Section" "blog") }}
|
||||||
|
{{ if gt $nbPosts 0 }}
|
||||||
|
<div class="page-heading">Latest posts</div>
|
||||||
<ul>
|
<ul>
|
||||||
{{ range first 5 (.Data.Pages.GroupByDate "Jan, 2006" "desc")}}
|
{{ range first .Site.Params.latestpostcount (where .Data.Pages "Section" "blog") }}
|
||||||
{{ $nbPages := len (where .Pages "Section" "blog")}}
|
|
||||||
{{ if ne $nbPages 0}}
|
|
||||||
<li class="groupby">{{ .Key }}</li>
|
|
||||||
{{ end }}
|
|
||||||
{{ range where .Pages.ByPublishDate "Section" "blog"}}
|
|
||||||
{{ partial "li.html" . }}
|
{{ partial "li.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{ $nbTotalGroup := len (.Data.Pages.GroupByDate "Jan, 2006" "desc")}}
|
{{ if gt $nbPosts .Site.Params.latestpostcount }}
|
||||||
{{ if gt $nbTotalGroup 5}}
|
|
||||||
<a href="./blog/" class="see-more">See more ...</a>
|
<a href="./blog/" class="see-more">See more ...</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
Reference in New Issue
Block a user