From a30c02a727cc62de36e9a061afc8fcc3704c4ff1 Mon Sep 17 00:00:00 2001 From: hyang Date: Sat, 6 Jan 2024 23:01:40 -0800 Subject: p --- layouts/_default/_markup/render-image.html.bk | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 layouts/_default/_markup/render-image.html.bk (limited to 'layouts/_default/_markup/render-image.html.bk') diff --git a/layouts/_default/_markup/render-image.html.bk b/layouts/_default/_markup/render-image.html.bk new file mode 100644 index 0000000..9bf57a9 --- /dev/null +++ b/layouts/_default/_markup/render-image.html.bk @@ -0,0 +1,29 @@ +{{- $url := urls.Parse .Destination -}} +{{- if $url.Scheme -}} + {{/* third party image */}} + {{ $.Text }} +{{- else -}} + {{/* internal image */}} + {{- $img := .Page.Resources.GetMatch .Destination -}} + {{- if not $img -}} + {{- $img = resources.Get .Destination -}} + {{- end -}} + + {{- if $img -}} + {{- if eq $img.MediaType.MainType "video" -}} +
+ +
+ {{- else -}} + {{ if (and (not (eq $img.MediaType.SubType "svg")) (gt $img.Height 800)) }} + {{ $img = $img.Resize "200x" }} + {{ end }} + {{ $.Text }} + {{- end -}} + {{- else -}} + {{- warnf "No image found for %s from %s" .Destination .Page.File }} + {{- end -}} +{{- end -}} -- cgit v1.2.3