diff options
| author | Reorx <novoreorx@gmail.com> | 2022-06-02 11:44:11 +0800 |
|---|---|---|
| committer | Reorx <novoreorx@gmail.com> | 2022-06-02 11:44:11 +0800 |
| commit | a2a26eb189fb1355ad09fc0085c81214bc3bdfc1 (patch) | |
| tree | ddfd7e4a0aba12e0b14b09a9a856ccdd864d3946 | |
| parent | 88b2584d06d6349089e96039b34de56187c99305 (diff) | |
update render-image to support video embed
just like embed an image, use 
| -rw-r--r-- | layouts/_default/_markup/render-image.html | 11 | ||||
| -rw-r--r-- | layouts/shortcodes/video.html | 3 |
2 files changed, 11 insertions, 3 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 -}} diff --git a/layouts/shortcodes/video.html b/layouts/shortcodes/video.html index 0132bb2..dd88719 100644 --- a/layouts/shortcodes/video.html +++ b/layouts/shortcodes/video.html @@ -1,7 +1,6 @@ <figure> <video class="video-shortcode" preload="{{ .Get "preload" }}" controls> <source src="{{ .Get "src" }}" type="{{ .Get "type" }}"> - There should have been a video here but your browser does not seem - to support it. + There should have been a video here but your browser does not seem to support it. </video> </figure> |
