Add remote param to img.html

This commit is contained in:
Will Faught
2023-01-07 08:29:09 -08:00
parent d0ff8d3a52
commit f3f47f5734

View File

@@ -7,33 +7,36 @@
{{ $options := .options }} {{ $options := .options }}
{{ $page := .page }} {{ $page := .page }}
{{ $referrerpolicy := .referrerpolicy | default "no-referrer" }} {{ $referrerpolicy := .referrerpolicy | default "no-referrer" }}
{{ $remote := .remote }}
{{ $resource := .resource }} {{ $resource := .resource }}
{{ $src := .src }} {{ $src := .src }}
{{ $style := .style }} {{ $style := .style }}
{{ $title := .title }} {{ $title := .title }}
{{ $width := .width }} {{ $width := .width }}
{{ if not $resource }} {{ if $remote }}
{{ $resource = partial "paige/func-resource.html" (dict {{ $src = relLangURL $src }}
"page" $page {{ else }}
"url" $src {{ 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 }} {{ 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 }}
<img {{ with $alt }} alt="{{ . }}" {{ end }} {{ with $class }} class="{{ . }}" {{ 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 }}> <img {{ with $alt }} alt="{{ . }}" {{ end }} {{ with $class }} class="{{ . }}" {{ 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 }}>