diff --git a/assets/styles/main.sass b/assets/styles/main.sass index c8ff35a..dfe1035 100644 --- a/assets/styles/main.sass +++ b/assets/styles/main.sass @@ -79,6 +79,9 @@ li margin-top: -10vh min-height: 50vh + .hero + margin: auto + @media screen and (max-width: $size-md) min-height: inherit diff --git a/layouts/actualites/single.html b/layouts/actualites/single.html index 749a337..4f0b1b2 100644 --- a/layouts/actualites/single.html +++ b/layouts/actualites/single.html @@ -1,13 +1,22 @@ {{ define "main" }}
{{ $headless := site.GetPage "/" }} - {{ $imageSize := "1208x459 Center webp" }} + {{ $widthOriginal := 1920 }} + {{ $heightOriginal := 850 }} + {{ $width := 1208 }} + {{ $height := 534 }} {{ $image := default ($headless.Resources.GetMatch "**.jpg") (.Resources.GetMatch (default "**.jpg" .Params.image)) }} {{ if $image }} - {{ $resized := $image.Fill $imageSize }} + {{ if and (ge $image.Width $widthOriginal) (ge $image.Height $heightOriginal) }} + {{ $image = $image.Process (printf "fill %dx%d Center webp" $width $height) }} + {{ else if gt $image.Height $height }} + {{ $image = $image.Process (printf "resize x%d webp" $height) }} + {{ else }} + {{ $image = $image.Process "webp" }} + {{ end }} {{ or .Params.image_ .Params.image_credit }}