2022-04-10 00:53:31 +02:00
|
|
|
{{- if strings.HasPrefix .Destination "http" -}}
|
2022-04-11 15:45:49 +02:00
|
|
|
<a href="{{- .Destination -}}" class="no_underline">
|
2022-04-10 00:53:31 +02:00
|
|
|
<img loading="lazy"
|
|
|
|
src="{{ .Destination | safeURL }}"
|
|
|
|
alt="{{ .Text }}"
|
|
|
|
{{ with .Title}} title="{{ . }}"{{ end }} />
|
2022-04-11 15:45:49 +02:00
|
|
|
<div class="dfjcc">{{ .Text }}</div>
|
2022-04-10 00:53:31 +02:00
|
|
|
</a>
|
|
|
|
{{- else -}}
|
2022-05-06 14:39:53 +02:00
|
|
|
{{ $ignore := slice (.Page.Resources.GetMatch "banner*") }}
|
|
|
|
{{ $images := .Page.Resources.ByType "image" }}
|
|
|
|
{{ $images = complement $ignore $images }}
|
|
|
|
{{ if where (.Page.Resources.ByType "image") ".File.TranslationBaseName" "!=" "banner*" }}
|
2022-06-15 12:59:10 +02:00
|
|
|
{{ $img_tmp := "" }}
|
|
|
|
{{ $dest := string (printf "%s.*" .Destination) }}
|
|
|
|
{{ if .Page.Resources.GetMatch $dest }}
|
|
|
|
{{- $img_tmp = .Page.Resources.GetMatch $dest -}}
|
|
|
|
{{ else }}
|
|
|
|
{{ $nr := .Destination }}
|
|
|
|
{{- $img_tmp = index $images (sub (int $nr) 1) -}}
|
|
|
|
{{ end }}
|
|
|
|
{{ if $img_tmp }}
|
|
|
|
{{- $image := .Page.Resources.GetMatch (printf "%s" ($img_tmp | safeURL)) -}}
|
2022-05-09 21:37:34 +02:00
|
|
|
<div class="article-image">
|
2022-04-11 15:45:49 +02:00
|
|
|
<a href="{{- $image.Permalink -}}" class="no_underline">
|
|
|
|
{{- $permalink := "" -}}
|
2022-04-10 00:53:31 +02:00
|
|
|
|
2022-04-11 15:45:49 +02:00
|
|
|
{{- if ne $image nil -}}
|
2022-06-15 02:08:16 +02:00
|
|
|
{{- $permalink = $image.Permalink -}}
|
2022-04-11 15:45:49 +02:00
|
|
|
{{- else -}}
|
|
|
|
{{- $image = imageConfig (printf "static/%s" (.Destination | safeURL)) -}}
|
|
|
|
{{- $permalink = (printf "/%s" (.Destination | safeURL)) -}}
|
|
|
|
{{- end -}}
|
2022-04-10 00:53:31 +02:00
|
|
|
|
2022-05-09 21:37:34 +02:00
|
|
|
<img loading="lazy"
|
2022-04-11 15:45:49 +02:00
|
|
|
src="{{ $permalink }}"
|
|
|
|
alt="{{ .Text }}"
|
|
|
|
{{ with .Title}} title="{{ . }}"{{ end }}
|
|
|
|
width={{ $image.Width }}
|
2022-05-09 21:37:34 +02:00
|
|
|
height="{{ $image.Height }}" />
|
|
|
|
<div>{{ .Text }}</div>
|
2022-04-11 15:45:49 +02:00
|
|
|
</a>
|
2022-04-10 00:53:31 +02:00
|
|
|
</div>
|
2022-04-21 11:54:27 +02:00
|
|
|
{{ end }}
|
2022-04-10 00:53:31 +02:00
|
|
|
{{ end }}
|
|
|
|
{{- end -}}
|