2021-05-23 01:42:17 +02:00
|
|
|
<div class="card has-equal-height mt-5">
|
|
|
|
<div class="card-image">
|
|
|
|
<figure class="image is-4by3 mt-5">
|
|
|
|
<img src="https://bulma.io/images/placeholders/1280x960.png" alt="Placeholder image">
|
|
|
|
</figure>
|
|
|
|
</div>
|
|
|
|
<div class="card-content" style="height:100%;">
|
|
|
|
<div class="has-text-centered">
|
|
|
|
<a class="title is-4" href="{{.Permalink}}">
|
|
|
|
<!--
|
|
|
|
Well, I am a beginner with Hugo so this is probably like crushing a banana with a rocket.
|
|
|
|
When a post belongs to a "case" (i.e. a section with a code, I'd like to have [INDEX/TOTAL] printed in title.
|
|
|
|
An when a post is on its own, don't print anything.
|
|
|
|
A little bit like : https://www.hacking-social.com/
|
|
|
|
But I don't wan't to write it manually because it could break when adding a blog post in between two existing blog posts.
|
|
|
|
So, iterate over the blog posts with same section as current blog post, order them by date and save the index of current blog post.
|
|
|
|
Maybe there is an easier way to get the same result...
|
|
|
|
-->
|
|
|
|
{{ $currentPost := . }}
|
|
|
|
{{ $currentPostIndex := 1 }}
|
|
|
|
{{ $posts := (where $.Site.RegularPages "CurrentSection.Params.Code" "==" $.CurrentSection.Params.Code )}}
|
|
|
|
{{ $postsSorted := (sort $posts "Date" )}}
|
|
|
|
{{ range $index, $element := $postsSorted }}
|
|
|
|
{{ if eq $element.Title $currentPost.Title }}
|
|
|
|
{{ $currentPostIndex = (add $index 1) }}
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
{{ with .CurrentSection.Params.Code }}
|
|
|
|
[{{ . }}{{ print $currentPostIndex }}]
|
|
|
|
{{ end }}
|
|
|
|
{{ .Title }}
|
2021-05-22 00:38:04 +02:00
|
|
|
</a>
|
2021-05-23 01:42:17 +02:00
|
|
|
</div>
|
|
|
|
<hr style="margin: 1rem 0;">
|
|
|
|
{{ .Summary }}
|
|
|
|
</div>
|
|
|
|
<footer class="card-footer">
|
|
|
|
<div class="is-size-7 has-text-centered card-footer-item">
|
|
|
|
<time datetime="{{ .Date.Format `2006-01-02T15:04:05Z07:00` | safeHTML }}">
|
|
|
|
{{ .Date.Day }} {{ index $.Site.Data.months_fr (printf "%d" .Date.Month) }} {{ .Date.Year }}
|
|
|
|
</time> — {{ .FuzzyWordCount }} mots
|
|
|
|
</div>
|
|
|
|
</footer>
|
|
|
|
</div>
|