mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2025-06-13 01:57:28 -05:00
Use a single figure shortcode that does either image or video
This commit is contained in:
17
layouts/partials/figure.html
Normal file
17
layouts/partials/figure.html
Normal file
@ -0,0 +1,17 @@
|
||||
<figure>
|
||||
{{ $media := . | resources.Fingerprint "sha512" }}
|
||||
{{ if eq .MediaType.MainType "image" }}
|
||||
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" />
|
||||
{{ else if eq .MediaType.MainType "video" }}
|
||||
<video controls>
|
||||
<source src="{{ $media.Permalink }}" alt="{{ $media.Title }}">
|
||||
{{ i18n "browser_no_video_support" }}
|
||||
</video>
|
||||
{{ end }}
|
||||
|
||||
{{ with $media.Title }}
|
||||
<figcaption>
|
||||
{{ . | markdownify }}
|
||||
</figcaption>
|
||||
{{ end }}
|
||||
</figure>
|
Reference in New Issue
Block a user