forked from Bunteshaus/bunteshaus.de
36 lines
1.4 KiB
HTML
36 lines
1.4 KiB
HTML
{{- if strings.HasPrefix .Destination "http" -}}
|
|
<a href="{{- .Destination -}}">
|
|
<img loading="lazy"
|
|
src="{{ .Destination | safeURL }}"
|
|
alt="{{ .Text }}"
|
|
{{ with .Title}} title="{{ . }}"{{ end }} />
|
|
<div style="display: flex; justify-content: center;">{{ .Text }}</div>
|
|
</a>
|
|
{{- else -}}
|
|
{{ if .Page.Resources.ByType "image" }}
|
|
{{ $nr := .Destination }}
|
|
{{- $pic := index (.Page.Resources.ByType "image") (int $nr) -}}
|
|
{{- $image := .Page.Resources.GetMatch (printf "%s" ($pic | safeURL)) -}}
|
|
<div>
|
|
<a href="{{- $image.Permalink -}}">
|
|
{{- $permalink := "" -}}
|
|
|
|
{{- if ne $image nil -}}
|
|
{{- $permalink = $image.RelPermalink -}}
|
|
{{- else -}}
|
|
{{- $image = imageConfig (printf "static/%s" (.Destination | safeURL)) -}}
|
|
{{- $permalink = (printf "/%s" (.Destination | safeURL)) -}}
|
|
{{- end -}}
|
|
|
|
<div style="display: flex; justify-content: center;"><img loading="lazy"
|
|
src="{{ $permalink }}"
|
|
alt="{{ .Text }}"
|
|
{{ with .Title}} title="{{ . }}"{{ end }}
|
|
width={{ $image.Width }}
|
|
height="{{ $image.Height }}" /></div>
|
|
<div style="display: flex; justify-content: center;">{{ .Text }}</div>
|
|
</a>
|
|
</div>
|
|
{{ end }}
|
|
{{- end -}}
|