Set height and width specifically on img tag

This commit is contained in:
2025-07-03 18:47:55 -05:00
parent 9d761b2f81
commit be12afb50d

View File

@ -7,18 +7,17 @@
{{ end }} {{ end }}
{{ with index . "src" }} {{ with index . "src" }}
{{ $media := . }}
{{ if eq .MediaType.MainType "image" }} {{ if eq .MediaType.MainType "image" }}
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" loading="lazy" /> <img src="{{ .Permalink }}" alt="{{ .Title }}" width="{{ .Width }}" height="{{ .Height }}" loading="lazy" />
{{ else if eq .MediaType.MainType "video" }} {{ else if eq .MediaType.MainType "video" }}
<video controls preload="metadata"> <video controls preload="metadata">
<source src="{{ $media.Permalink }}" alt="{{ $media.Title }}"> <source src="{{ .Permalink }}" alt="{{ .Title }}">
{{ i18n "browser_no_video_support" }} {{ i18n "browser_no_video_support" }}
</video> </video>
{{ end }} {{ end }}
{{ if not $hidecaption }} {{ if not $hidecaption }}
{{ with $media.Title }} {{ with .Title }}
<figcaption> <figcaption>
{{ . | markdownify }} {{ . | markdownify }}
</figcaption> </figcaption>