2023-09-28 10:05:00 +02:00
< div class = "card has-equal-height {{ if .Params.incoming }}has-background-white-bis{{ end }}" >
2021-05-23 01:42:17 +02:00
< div class = "card-image" >
2021-05-27 00:26:57 +02:00
< figure class = "image is-3by2" >
{{ $imageURL := "https://bulma.io/images/placeholders/480x320.png" }}
2021-05-26 23:18:11 +02:00
{{ with .Resources.GetMatch "top.jpg" }}
2022-11-07 01:59:36 +01:00
{{ $image := .Fill "480x320 left" }}
2023-09-28 10:05:00 +02:00
{{/* #FIXME why do $image gets overwritten when $imageURL is set only once outside the conditional */}}
{{ if $.Params.incoming }}{{ $image = $image.Filter (images.Grayscale)}}{{ $imageURL = $image.Permalink }}
{{ else }}
2022-11-07 01:59:36 +01:00
{{ $imageURL = $image.Permalink }}
2021-05-26 23:18:11 +02:00
{{ end }}
2023-09-28 10:05:00 +02:00
{{ end }}
< a class = "{{ if .Params.incoming }}disabled{{ end }}" href = "{{ if .Params.incoming }}#{{ else }}{{ .Permalink }}{{ end }}" > < img src = "{{ $imageURL }}" alt = "Placeholder image" > < / a >
2021-05-23 01:42:17 +02:00
< / figure >
< / div >
2023-08-21 17:31:43 +02:00
< div class = "columns is-flex-direction-column card-content pb-0" style = "height:100%;" >
< div class = "column is-flex-grow-0 has-text-centered pb-0" >
2023-09-28 10:05:00 +02:00
< a class = "title is-4 mb-0 {{ if .Params.incoming }}disabled{{ end }}" href = "{{ if .Params.incoming }}#{{ else }}{{.Permalink}}{{ end }}" >
2023-09-09 08:47:26 +02:00
{{- /*
2021-05-23 01:42:17 +02:00
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...
2023-08-10 15:23:42 +02:00
*/}}
2021-05-23 01:42:17 +02:00
{{ $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 >
2023-09-09 11:29:28 +02:00
< div class = "column is-flex-grow-0 pt-2 pb-3" >
2023-08-21 17:31:43 +02:00
< hr class = "my-0" >
< / div >
2023-09-28 10:22:01 +02:00
< div class = "column py-0 has-text-centered" >
2023-09-28 10:05:00 +02:00
{{ if .Params.incoming }}
À venir...
2023-09-09 08:47:26 +02:00
{{- /* If a special summary (before ToC) have been defined,
2023-08-10 15:23:42 +02:00
prefer using it because it has more chances to be a better summary */}}
2023-09-28 10:05:00 +02:00
{{ else if (isset .Params "summary" )}}
2023-08-21 17:31:43 +02:00
{{ .Params.summary }}
{{ else }}
{{ .Content | plainify | safeHTML | truncate 300 "..." }}
{{ end }}
< / div >
2021-05-23 01:42:17 +02:00
< / div >
2021-05-25 00:25:58 +02:00
< footer class = "card-footer has-text-centered" >
2022-11-07 01:59:36 +01:00
{{ with .Params.categories }}
< div class = "card-footer-item is-centered is-rounded" >
{{ range . }}
< span class = "tag mx-1" > < a href = "{{ " categories " | absURL } } / { { . | urlize } } " > {{ . }}< / a > < / span >
2021-05-25 00:25:58 +02:00
{{ end }}
2022-11-07 01:59:36 +01:00
< / div >
{{ end }}
< div class = "card-footer-item is-size-7" >
< div class = "level is-mobile" >
< div class = "level-right" >
< div class = "level-item" >
< time datetime = "{{ .Date.Format `2006-01-02T15:04:05Z07:00` | safeHTML }}" >
2023-09-28 10:22:01 +02:00
{{ .PublishDate.Day }} {{ slicestr (index $.Site.Data.months_fr (printf "%d" .PublishDate.Month)) 0 3 }}
{{ .PublishDate.Year }}
2022-11-07 01:59:36 +01:00
< / div >
< / div >
< div class = "level-left" >
< div class = "level-item" >
< / time > — {{ div .FuzzyWordCount 230 }} min
< / div >
< / div >
2021-05-25 00:25:58 +02:00
< / div >
2022-11-07 01:59:36 +01:00
< / div >
< / footer >
< / div >