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