summaryrefslogtreecommitdiff
path: root/layouts/_default/_markup
diff options
context:
space:
mode:
authorReorx <novoreorx@gmail.com>2022-06-02 11:44:11 +0800
committerReorx <novoreorx@gmail.com>2022-06-02 11:44:11 +0800
commita2a26eb189fb1355ad09fc0085c81214bc3bdfc1 (patch)
treeddfd7e4a0aba12e0b14b09a9a856ccdd864d3946 /layouts/_default/_markup
parent88b2584d06d6349089e96039b34de56187c99305 (diff)
update render-image to support video embed
just like embed an image, use ![](/path/to/video.mov)
Diffstat (limited to 'layouts/_default/_markup')
-rw-r--r--layouts/_default/_markup/render-image.html11
1 files changed, 10 insertions, 1 deletions
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html
index 1aa9839..0fc039c 100644
--- a/layouts/_default/_markup/render-image.html
+++ b/layouts/_default/_markup/render-image.html
@@ -5,7 +5,16 @@
{{- end -}}
{{- if $img -}}
- <img loading="lazy" src="{{ $img.RelPermalink }}" alt="{{ $.Text }}" {{ with $.Title}} title="{{ . }}" {{ end }} />
+ {{- if eq $img.MediaType.MainType "video" -}}
+ <figure>
+ <video class="video-shortcode" preload="metadata" controls>
+ <source src="{{ $img.RelPermalink }}">
+ There should have been a video here but your browser does not seem to support it.
+ </video>
+ </figure>
+ {{- else -}}
+ <img loading="lazy" src="{{ $img.RelPermalink }}" type="" alt="{{ $.Text }}" {{ with $.Title}} title="{{ . }}" {{ end }} />
+ {{- end -}}
{{- else -}}
{{- warnf "No image found for %s from %s" .Destination .Page.File }}
{{- end -}}