38 lines
1.5 KiB
HTML
38 lines
1.5 KiB
HTML
{{- if strings.HasPrefix .Destination "http" -}}
|
|
<a href="{{- .Destination -}}" class="no_underline">
|
|
<img loading="lazy"
|
|
src="{{ .Destination | safeURL }}"
|
|
alt="{{ .Text }}"
|
|
{{ with .Title}} title="{{ . }}"{{ end }} />
|
|
<div class="dfjcc">{{ .Text }}</div>
|
|
</a>
|
|
{{- else -}}
|
|
{{ if .Page.Resources.ByType "image" }}
|
|
{{ $nr := .Destination }}
|
|
{{- $pic := index (.Page.Resources.ByType "image") (sub (int $nr) 1) -}}
|
|
{{- $image := .Page.Resources.GetMatch (printf "%s" ($pic | safeURL)) -}}
|
|
{{ if ne $image nil }}
|
|
<div>
|
|
<a href="{{- $image.Permalink -}}" class="no_underline">
|
|
{{- $permalink := "" -}}
|
|
|
|
{{- if ne $image nil -}}
|
|
{{- $permalink = $image.RelPermalink -}}
|
|
{{- else -}}
|
|
{{- $image = imageConfig (printf "static/%s" (.Destination | safeURL)) -}}
|
|
{{- $permalink = (printf "/%s" (.Destination | safeURL)) -}}
|
|
{{- end -}}
|
|
|
|
<div class="dfjcc"><img loading="lazy"
|
|
src="{{ $permalink }}"
|
|
alt="{{ .Text }}"
|
|
{{ with .Title}} title="{{ . }}"{{ end }}
|
|
width={{ $image.Width }}
|
|
height="{{ $image.Height }}" /></div>
|
|
<div class="dfjcc">{{ .Text }}</div>
|
|
</a>
|
|
</div>
|
|
{{ end }}
|
|
{{ end }}
|
|
{{- end -}}
|