bobatheme/layouts/partials/figure.html
BBaoVanC 7ffa6c068c
Improve figures
- Add option to disable border and caption
2021-10-27 09:49:21 -05:00

30 lines
711 B
HTML

{{ $hidecaption := index . "hidecaption" }}
{{ if index . "border" }}
<figure class="border">
{{ else }}
<figure>
{{ end }}
{{ with index . "src" }}
{{ $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 }}
{{ if not $hidecaption }}
{{ with $media.Title }}
<figcaption>
{{ . | markdownify }}
</figcaption>
{{ end }}
{{ end }}
{{ end }}
</figure>