feat(actualites): allow cover images in articles

This commit is contained in:
Matthieu Bessat 2024-09-15 18:26:10 +02:00
parent 578f913430
commit b9aa6720a7
3 changed files with 19 additions and 6 deletions

View file

@ -18,11 +18,10 @@
text-align: center;
img {
object-fit: fit;
aspect-ratio: 1;
max-height: 50vh;
max-height: 40vh;
max-width: 100%;
}
margin-bottom: 0;
}
// card in list

View file

@ -12,7 +12,7 @@ body {
font-weight: 400;
margin: 0;
font-size: 17px;
line-height: 1.6;
line-height: 1.5;
}
* {

View file

@ -18,8 +18,7 @@
{{ end }}
</div>
{{ if .Params.featured_image }}
{{ if and .Params.featured_image (not .Params.cover_image) }}
{{ $featuredImage := .Resources.GetMatch (.Params.featured_image.src | safeURL) }}
{{ if $featuredImage }}
{{ $featuredImage = $featuredImage.Resize "900x" }}
@ -34,6 +33,21 @@
{{ end }}
{{ end }}
{{ if .Params.cover_image }}
{{ $img := .Resources.GetMatch (.Params.cover_image.src | safeURL) }}
{{ if $img }}
{{ $img = $img.Resize "900x" }}
<div class="single-figure-container article__featured-image-container">
<figure class="article__featured-image fig-img">
<img alt="" src="{{ $img.RelPermalink }}" />
{{ with .Params.cover_image.caption }}
<figcaption>{{ . }}</figcaption>
{{ end }}
</figure>
</div>
{{ end }}
{{ end }}
{{ range .Params.tags }}
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}