1
0
Fork 0
faulty.equipment/themes/fesite/layouts/_default/_markup/render-image.html
Hamcha 845acbb16c
All checks were successful
continuous-integration/drone/push Build is passing
begone project list
2023-10-06 13:29:25 +02:00

49 lines
1.8 KiB
HTML

<figure width="100%">
<a href="#{{ .Destination | md5 }}-lightbox"
><picture>
{{ $avifPath:= replace .Destination (path.Ext .Destination) ".avif" }} {{
$avifPathStatic:= printf "static/%s" $avifPath }} {{ if (fileExists
$avifPathStatic) -}}
<source srcset="{{ $avifPath | safeURL }}" type="image/avif" />
{{- end }} {{ if eq (path.Ext .Destination) ".jpg" }}
<source type="image/jpeg" srcset="{{ .Destination | safeURL }}" />
{{ end }} {{ if eq (path.Ext .Destination) ".jpeg" }}
<source type="image/jpeg" srcset="{{ .Destination | safeURL }}" />
{{ end }} {{ if eq (path.Ext .Destination) ".png" }}
<source
type="image/png"
srcset="{{
.Destination | safeURL }}"
/>
{{ end }}
<img src="{{ .Destination | safeURL }}" alt="{{ .PlainText }}" />
</picture>
</a>
<figcaption>
{{ if .Title }}
<p>{{ .Title | markdownify }}</p>
{{ else if .Text }}
<p>{{ .Text | htmlUnescape }}</p>
{{ end }}
</figcaption>
</figure>
<a href="#_" class="lightbox" id="{{ .Destination | md5 }}-lightbox">
<picture>
{{ $avifPath:= replace .Destination (path.Ext .Destination) ".avif" }} {{
$avifPathStatic:= printf "static/%s" $avifPath }} {{ if (fileExists
$avifPathStatic) -}}
<source srcset="{{ $avifPath | safeURL }}" type="image/avif" />
{{- end }} {{ if eq (path.Ext .Destination) ".jpg" }}
<source type="image/jpeg" srcset="{{ .Destination | safeURL }}" />
{{ end }} {{ if eq (path.Ext .Destination) ".jpeg" }}
<source type="image/jpeg" srcset="{{ .Destination | safeURL }}" />
{{ end }} {{ if eq (path.Ext .Destination) ".png" }}
<source
type="image/png"
srcset="{{
.Destination | safeURL }}"
/>
{{ end }}
<img src="{{ .Destination | safeURL }}" alt="{{ .PlainText }}" />
</picture>
</a>