|
@@ -64,21 +64,29 @@
|
|
{{- $image = resources.Get (path.Join "media" $page.Params.hero_media) -}}
|
|
{{- $image = resources.Get (path.Join "media" $page.Params.hero_media) -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{ if $image }}
|
|
{{ if $image }}
|
|
- {{ $legacy_img := $image.Resize "400x" }}
|
|
|
|
- {{ $img_src := "" }}
|
|
|
|
- {{ $img_src_set := slice }}
|
|
|
|
- {{ $widths := slice 1200 800 400 }}
|
|
|
|
|
|
+ {{ $isSVG := eq $image.MediaType.SubType "svg" }}
|
|
|
|
+ {{ if $isSVG -}}
|
|
|
|
|
|
- {{ range $widths }}
|
|
|
|
- {{ $src_link := ($image.Resize (printf "%dx" .)).RelPermalink }}
|
|
|
|
- {{ if eq $img_src "" }}
|
|
|
|
- {{ $img_src = $src_link }}
|
|
|
|
|
|
+ <img src="{{ $image.RelPermalink }}" alt="{{ $page.Title }}">
|
|
|
|
+
|
|
|
|
+ {{- else }}
|
|
|
|
+
|
|
|
|
+ {{ $legacy_img := $image.Resize "400x" }}
|
|
|
|
+ {{ $img_src := "" }}
|
|
|
|
+ {{ $img_src_set := slice }}
|
|
|
|
+ {{ $widths := slice 1200 800 400 }}
|
|
|
|
+
|
|
|
|
+ {{ range $widths }}
|
|
|
|
+ {{ $src_link := ($image.Resize (printf "%dx" .)).RelPermalink }}
|
|
|
|
+ {{ if eq $img_src "" }}
|
|
|
|
+ {{ $img_src = $src_link }}
|
|
|
|
+ {{ end }}
|
|
|
|
+ {{ $img_src_set = $img_src_set | append (printf "%s %dw" $src_link .) }}
|
|
{{ end }}
|
|
{{ end }}
|
|
- {{ $img_src_set = $img_src_set | append (printf "%s %dw" $src_link .) }}
|
|
|
|
- {{ end }}
|
|
|
|
- {{ $img_src_set = delimit $img_src_set "," }}
|
|
|
|
|
|
+ {{ $img_src_set = delimit $img_src_set "," }}
|
|
|
|
|
|
- <img src="{{ $legacy_img.RelPermalink }}" srcset="{{ $img_src_set }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ $page.Title }}">
|
|
|
|
|
|
+ <img src="{{ $legacy_img.RelPermalink }}" srcset="{{ $img_src_set }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ $page.Title }}">
|
|
|
|
+ {{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|