From b9aa6720a72f8be4e2a221c10bd090d4f0730309 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Sun, 15 Sep 2024 18:26:10 +0200 Subject: [PATCH] feat(actualites): allow cover images in articles --- assets/sass/article.scss | 5 ++--- assets/sass/general.scss | 2 +- layouts/actualites/single.html | 18 ++++++++++++++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/assets/sass/article.scss b/assets/sass/article.scss index f831da8..d7fa5ef 100644 --- a/assets/sass/article.scss +++ b/assets/sass/article.scss @@ -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 diff --git a/assets/sass/general.scss b/assets/sass/general.scss index 23defe9..dc8e3de 100644 --- a/assets/sass/general.scss +++ b/assets/sass/general.scss @@ -12,7 +12,7 @@ body { font-weight: 400; margin: 0; font-size: 17px; - line-height: 1.6; + line-height: 1.5; } * { diff --git a/layouts/actualites/single.html b/layouts/actualites/single.html index 84e0ecf..b90caa7 100644 --- a/layouts/actualites/single.html +++ b/layouts/actualites/single.html @@ -18,8 +18,7 @@ {{ end }} - - {{ 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" }} +
+
+ + {{ with .Params.cover_image.caption }} +
{{ . }}
+ {{ end }} +
+
+ {{ end }} + {{ end }} + {{ range .Params.tags }} {{ . }} {{ end }}