diff options
author | Oscar Najera <hi@oscarnajera.com> | 2023-10-15 15:45:53 +0200 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2023-10-15 16:12:14 +0200 |
commit | bd924ee52abf96ef3f6352b7b2926d9900ae5ff9 (patch) | |
tree | 41351e887478db5f5a0fc3702e24449d999d41e0 /layouts/partials/post.html | |
parent | d0200f3f07604edab12d647838feebfd82423f67 (diff) | |
download | hugo-minimalist-theme-bd924ee52abf96ef3f6352b7b2926d9900ae5ff9.tar.gz hugo-minimalist-theme-bd924ee52abf96ef3f6352b7b2926d9900ae5ff9.tar.bz2 hugo-minimalist-theme-bd924ee52abf96ef3f6352b7b2926d9900ae5ff9.zip |
Hero background gradient and post images default
Feature image has precedence
Can have svg feature images. That implies container must have max width
Diffstat (limited to 'layouts/partials/post.html')
-rw-r--r-- | layouts/partials/post.html | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/layouts/partials/post.html b/layouts/partials/post.html index fa6d485..fe24ad9 100644 --- a/layouts/partials/post.html +++ b/layouts/partials/post.html @@ -3,15 +3,22 @@ <h3 class="f3 baskerville mt0 lh-title">{{ .Title }}</h3> <div class="cf"> {{ $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 := .Resize (default "320x" .Params.thumbnail_size) }} <div class="fl-ns mb4 mb0-ns pr3-ns"> - <img src="{{ $image.RelPermalink }}" class="db center" /> + <img + src="{{ if ne .MediaType.SubType "svg" }} + {{ $image := .Resize (default "320x" .Params.thumbnail_size) }} + {{ $image.RelPermalink }} + {{ else }} + {{ $image.RelPermalink }} + {{ end }}" + class="mw5-ns db center" + /> </div> {{ end }} <div class="f5 lh-copy"> |