You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.7 KiB
HTML

{{ $alt := .alt }}
{{ $class := .class }}
{{ $crossorigin := .crossorigin | default "anonymous" }}
{{ $fetchpriority := .fetchpriority }}
{{ $height := .height }}
{{ $loading := .loading | default "lazy" }}
{{ $method := .method }}
{{ $options := .options }}
{{ $page := .page }}
{{ $referrerpolicy := .referrerpolicy | default "no-referrer" }}
{{ $remote := .remote }}
{{ $resource := .resource }}
{{ $src := .src }}
{{ $style := .style }}
{{ $title := .title }}
{{ $width := .width }}
{{ if $remote }}
{{ $src = relLangURL $src }}
{{ else }}
{{ if not $resource }}
{{ $resource = partial "paige/func-resource.html" (dict
"page" $page
"url" $src
) }}
{{ end }}
{{ if and $method $options }}
{{ if eq $method "crop" }}
{{ $resource = $resource.Crop $options }}
{{ else if eq $method "fill" }}
{{ $resource = $resource.Fill $options }}
{{ else if eq $method "fit" }}
{{ $resource = $resource.Fit $options }}
{{ else if eq $method "resize" }}
{{ $resource = $resource.Resize $options }}
{{ else }}
{{ errorf "invalid method: %q" $method }}
{{ end }}
{{ end }}
{{ $src = ($resource | fingerprint).RelPermalink }}
{{ end }}
<img {{ with $alt }} alt="{{ . }}" {{ end }} {{ with $class }} class="{{ . }}" {{ end }} {{ with $crossorigin }} crossorigin="{{ . }}" {{ end }} {{ with $fetchpriority }} fetchpriority="{{ . }}" {{ end }} {{ with $height }} height="{{ . }}" {{ end }} loading="{{ $loading }}" referrerpolicy="{{ $referrerpolicy }}" src="{{ $src }}" {{ with $style }} style="{{ . | safeCSS }}" {{ end }} {{ with $title }} title="{{ . }}" {{ end }} {{ with $width }} width="{{ . }}" {{ end }}>