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; text-align: center;
img { img {
object-fit: fit; max-height: 40vh;
aspect-ratio: 1;
max-height: 50vh;
max-width: 100%; max-width: 100%;
} }
margin-bottom: 0;
} }
// card in list // card in list

View file

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

View file

@ -18,8 +18,7 @@
{{ end }} {{ end }}
</div> </div>
{{ if and .Params.featured_image (not .Params.cover_image) }}
{{ if .Params.featured_image }}
{{ $featuredImage := .Resources.GetMatch (.Params.featured_image.src | safeURL) }} {{ $featuredImage := .Resources.GetMatch (.Params.featured_image.src | safeURL) }}
{{ if $featuredImage }} {{ if $featuredImage }}
{{ $featuredImage = $featuredImage.Resize "900x" }} {{ $featuredImage = $featuredImage.Resize "900x" }}
@ -34,6 +33,21 @@
{{ end }} {{ end }}
{{ 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 }} {{ range .Params.tags }}
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a> <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }} {{ end }}