From bd924ee52abf96ef3f6352b7b2926d9900ae5ff9 Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Sun, 15 Oct 2023 15:45:53 +0200 Subject: Hero background gradient and post images default Feature image has precedence Can have svg feature images. That implies container must have max width --- layouts/_default/single.html | 21 ++++++++++++++++----- layouts/partials/hero.html | 8 ++++++-- layouts/partials/post.html | 17 ++++++++++++----- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 23341f4..5405e4a 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -13,16 +13,27 @@ {{ end }} {{ $image := "" }} - {{ if resources.Get (index .Params.images 0) }} - {{ $image = resources.Get (index .Params.images 0) }} - {{ else if (.Resources.ByType "image").GetMatch "*featured*" }} + {{ if (.Resources.ByType "image").GetMatch "*featured*" }} {{ $image = (.Resources.ByType "image").GetMatch "*featured*" }} + {{ else if resources.Get (index .Params.images 0) }} + {{ $image = resources.Get (index .Params.images 0) }} {{ end }} {{ with $image }} - {{ $image := .Fit (default "400x400" $.Params.image_size) }} + {{ if ne $image.MediaType.SubType "svg" }} + {{ $image := .Fit (default "400x400" $.Params.image_size) }} + {{ end }}