28 lines
885 B
HTML
28 lines
885 B
HTML
<p>
|
|
{{- $img := or (.Get "src") (.Get "img") -}}
|
|
{{- $ref := .Get "ref" -}}
|
|
{{- $scale := .Get "scale" -}}
|
|
{{- $alt := or (.Get "alt") (.Get "title") -}}
|
|
{{- $class := .Get "class" -}}
|
|
{{- $refImg := "" -}}
|
|
{{- $refPage := "" -}}
|
|
{{- if $ref -}}
|
|
{{- range where .Site.RegularPages "Params.pageid" "eq" $ref -}}
|
|
{{- $refImg = .Params.img -}}
|
|
{{- $refPage = . -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- if not $img -}}
|
|
{{- $img = $refImg -}}
|
|
{{- end -}}
|
|
{{- $image := (resources.Get (printf "img/%s" $img)) -}}
|
|
{{- if $scale -}}
|
|
{{- $image = $image.Resize $scale -}}
|
|
{{- end -}}
|
|
{{- if $refPage -}}
|
|
<a href="{{ $refPage.Permalink }}"><img
|
|
src="{{ $image.RelPermalink }}" alt="{{ or $alt $refPage.Title }}"></a>
|
|
{{- else -}}
|
|
<img src="{{ $image.RelPermalink }}" alt="{{ $alt }}" class="{{ $class }}">
|
|
{{- end -}}
|
|
</p>
|