mirror of
https://github.com/Noettore/cocoa-eh-hugo-theme.git
synced 2025-10-15 03:36:41 +02:00
Add best posts and group by date
This commit is contained in:
@@ -22,7 +22,7 @@ logofile = "img/logo.png"
|
||||
faviconfile = "img/logo.png"
|
||||
highlightjs = true
|
||||
progressively = true
|
||||
latestpostcount = 10
|
||||
latestpostcount = 5
|
||||
lang = "en"
|
||||
github = "example"
|
||||
email = "you@example.com"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
author: "Alexis Tacnet"
|
||||
date: 2015-09-28
|
||||
title: Example article
|
||||
best: true
|
||||
---
|
||||
|
||||
## Text
|
||||
|
@@ -10,6 +10,7 @@
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="posts">
|
||||
{{ if ne (len (where .Data.Pages "Title" "!=" $globalTitle)) 0}}
|
||||
<div class="page-heading">{{ .Title }}</div>
|
||||
<ul>
|
||||
@@ -22,5 +23,6 @@
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{{ partial "footer.html" . }}
|
||||
|
@@ -8,13 +8,17 @@
|
||||
</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 .Data.Pages "Section" "blog") }}
|
||||
{{ 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 }}
|
||||
@@ -22,6 +26,21 @@
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="posts">
|
||||
{{ $nbPosts := len (where .Data.Pages "Params.best" true) }}
|
||||
{{ if gt $nbPosts 0 }}
|
||||
<div class="page-heading">Best posts</div>
|
||||
<ul>
|
||||
{{ range .Data.Pages.ByPublishDate }}
|
||||
{{ if eq .Params.best true }}
|
||||
{{ partial "li.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{{ partial "footer.html" . }}
|
||||
|
@@ -2,6 +2,7 @@
|
||||
<section class="main">
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<div class="posts">
|
||||
<div class="page-heading">Blog</div>
|
||||
<ul>
|
||||
{{ range .Data.Pages.GroupByDate "Jan, 2006" "desc"}}
|
||||
@@ -13,5 +14,6 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{{ partial "footer.html" . }}
|
||||
|
@@ -495,6 +495,9 @@ section.main .content .title-container {
|
||||
-ms-justify-content: space-between;
|
||||
justify-content: space-between;
|
||||
}
|
||||
section.main .content .posts {
|
||||
margin-bottom: 4em;
|
||||
}
|
||||
section.main .content .page-heading {
|
||||
font-size: 18px;
|
||||
font-family: 'Raleway', 'Helvetica Neue', 'Arial', sans-serif;
|
||||
@@ -637,9 +640,6 @@ section.header {
|
||||
section.header-home {
|
||||
padding-top: 36px;
|
||||
}
|
||||
section.icons {
|
||||
padding-top: 0;
|
||||
}
|
||||
section.main {
|
||||
padding-top: 32px;
|
||||
padding-bottom: 32px;
|
||||
@@ -660,7 +660,6 @@ section.main .container .content .post-item {
|
||||
padding-bottom: 60px;
|
||||
}
|
||||
section.icons {
|
||||
padding-top: 60px;
|
||||
padding-bottom: 60px;
|
||||
}
|
||||
section.main {
|
||||
|
Reference in New Issue
Block a user