45 lines
1.9 KiB
HTML
45 lines
1.9 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 -}}
|
|
{{ $ignore := slice (.Page.Resources.GetMatch "banner*") }}
|
|
{{ $images := .Page.Resources.ByType "image" }}
|
|
{{ $images = complement $ignore $images }}
|
|
{{ if where (.Page.Resources.ByType "image") ".File.TranslationBaseName" "!=" "banner*" }}
|
|
{{ $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)) -}}
|
|
{{- $permalink := "" -}}
|
|
|
|
{{- if ne $image nil -}}
|
|
{{- $permalink = $image.Permalink -}}
|
|
{{- else -}}
|
|
{{- $image = imageConfig (printf "static/%s" (.Destination | safeURL)) -}}
|
|
{{- $permalink = (printf "/%s" (.Destination | safeURL)) -}}
|
|
{{- end -}}
|
|
|
|
<a href="{{- $image.Permalink -}}" class="article_image no_underline">
|
|
<img loading="lazy"
|
|
src="{{ $permalink }}"
|
|
alt="{{ .Text }}"
|
|
{{ with .Title}} title="{{ . }}"{{ end }}
|
|
width={{ $image.Width }}
|
|
height="{{ $image.Height }}" /><br>
|
|
{{ .Text }}
|
|
</a>
|
|
{{ end }}
|
|
{{ end }}
|
|
{{- end -}}
|