REMOVE content and assets FIX image render

This commit is contained in:
Hoernschen 2024-06-19 23:45:14 +02:00
parent 62f343ef90
commit e385e4ee4d
Signed by: hoernschen
GPG key ID: 37591FAF4E6D3462
10 changed files with 26 additions and 91 deletions

View file

@ -23,31 +23,33 @@ caption: string
{{ $dir := path.Dir $url }}
{{ $mediaWidthControl := "(min-width: 1240px) 50px, 70vw" }}
<picture>
{{- if eq hugo.Environment "development" }}
<img class="{{ .type }}" width="{{ $width }}" height="{{ $height }}" src="{{ $url }}" alt="{{ .alt }}" loading="lazy"
decoding="async">
{{ else }}
<source type="image/avif" srcset="
<a href="{{ $url }}">
<picture>
{{- if eq hugo.Environment "development" }}
<img class="{{ .type }}" width="{{ $width }}" height="{{ $height }}" src="{{ $url }}" alt="{{ .alt }}"
loading="lazy" decoding="async">
{{ else }}
<source type="image/avif" srcset="
{{ range $i, $size := $sizes }}
{{ $dir }}/{{ $name }}-{{ $size }}{{ $ext }}.avif {{ $size }}w,
{{ end }}
{{ $url }}.avif {{ $width }}w
" sizes="{{ $mediaWidthControl }}" />
<source type="image/webp" srcset="
<source type="image/webp" srcset="
{{ range $i, $size := $sizes }}
{{ $dir }}/{{ $name }}-{{ $size }}{{ $ext }}.webp {{ $size }}w,
{{ end }}
{{ $url }}.webp {{ $width }}w
" sizes="{{ $mediaWidthControl }}" />
<img class="{{ .type }}" width="{{ $width }}" height="{{ $height }}" srcset="
<img class="{{ .type }}" width="{{ $width }}" height="{{ $height }}" srcset="
{{ range $i, $size := $sizes }}
{{ $dir }}/{{ $name }}-{{ $size }}{{ $ext }} {{ $size }}w,
{{ end }}
{{ $url }} {{ $width }}w
" src="{{ $url }}" alt="{{ .alt }}" loading="lazy" decoding="async">
{{ end }}
</picture>
{{ end }}
</picture>
</a>
{{ if .caption }}
<p class="caption">{{ .caption }}</p>
{{ end }}