Trying to lazy-load timeline images

This commit is contained in:
Asaf Gartner 2024-07-08 14:19:45 +03:00
parent 5fb6bf59f7
commit da80261202
1 changed files with 1 additions and 1 deletions

View File

@ -60,7 +60,7 @@
{{ range .Media }} {{ range .Media }}
<div class="timeline-media mt3 {{ if eq .Type mediaembed }}timeline-embed{{ end }} overflow-hidden flex {{ if not (eq .Type mediaunknown) }}justify-center{{ end }}"> <div class="timeline-media mt3 {{ if eq .Type mediaembed }}timeline-embed{{ end }} overflow-hidden flex {{ if not (eq .Type mediaunknown) }}justify-center{{ end }}">
{{ if eq .Type mediaimage }} {{ if eq .Type mediaimage }}
<img src="{{ .AssetUrl }}"> <img decoding="async" loading="lazy" src="{{ .AssetUrl }}" {{ if and .Width .Height }}style="aspect-ratio: {{ .Width }} / {{ .Height }};"{{ end }} />
{{ else if eq .Type mediavideo }} {{ else if eq .Type mediavideo }}
{{ if .ThumbnailUrl }} {{ if .ThumbnailUrl }}
<video src="{{ .AssetUrl }}" poster="{{ .ThumbnailUrl }}" preload="none" controls> <video src="{{ .AssetUrl }}" poster="{{ .ThumbnailUrl }}" preload="none" controls>