aboutsummaryrefslogtreecommitdiffstats
path: root/layouts/_default/single.html
diff options
context:
space:
mode:
authorOscar Najera <hi@oscarnajera.com>2023-10-15 15:45:53 +0200
committerOscar Najera <hi@oscarnajera.com>2023-10-15 16:12:14 +0200
commitbd924ee52abf96ef3f6352b7b2926d9900ae5ff9 (patch)
tree41351e887478db5f5a0fc3702e24449d999d41e0 /layouts/_default/single.html
parentd0200f3f07604edab12d647838feebfd82423f67 (diff)
downloadhugo-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/_default/single.html')
-rw-r--r--layouts/_default/single.html21
1 files changed, 16 insertions, 5 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 }}
<div class="tc">
<div class="relative dib">
- <img src="{{ $image.RelPermalink }}" class="ma0" alt="{{ .Title }}" />
+ <img
+ src="{{ if ne .MediaType.SubType "svg" }}
+ {{ $image := .Fit (default "400x400" $.Params.image_size) }}
+ {{ $image.RelPermalink }}
+ {{ else }}
+ {{ $image.RelPermalink }}
+ {{ end }}"
+ class="ma0"
+ alt="{{ .Title }}"
+ />
{{ with $.Params.caption }}
<a
href="{{ .url }}"