Files
bobatheme/layouts/_partials/figure.html
BBaoVanC cc7cec07df Revert "Set height and width specifically on img tag"
This reverts commit be12afb50d.

It causes issues with aspect ratio when the raw width of the image is
wider than the width in CSS pixels allowed by the body max-width.

Not reverting the refactor that removes {{ $img = . }} because I don't
know why that was there and will see if it works fine with it still
removed.
2025-07-03 20:15:17 -05:00

28 lines
781 B
HTML

{{ $hidecaption := index . "hidecaption" }}
{{ if index . "noborder" }}
<figure>
{{ else }}
<figure class="border">
{{ end }}
{{ with index . "src" }}
{{ if eq .MediaType.MainType "image" }}
<img src="{{ .Permalink }}" alt="{{ .Title }}" loading="lazy" />
{{ else if eq .MediaType.MainType "video" }}
<video controls preload="metadata">
<source src="{{ .Permalink }}" alt="{{ .Title }}">
{{ i18n "browser_no_video_support" }}
</video>
{{ end }}
{{ if not $hidecaption }}
{{ with .Title }}
<figcaption>
{{ . | markdownify }}
</figcaption>
{{ end }}
{{ end }}
{{ end }}
</figure>