From f3f47f5734259ecde34483f176904ae9f5769f58 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Sat, 7 Jan 2023 08:29:09 -0800 Subject: [PATCH] Add remote param to img.html --- layouts/partials/paige/img.html | 45 ++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/layouts/partials/paige/img.html b/layouts/partials/paige/img.html index 193e792e..06c3d95b 100644 --- a/layouts/partials/paige/img.html +++ b/layouts/partials/paige/img.html @@ -7,33 +7,36 @@ {{ $options := .options }} {{ $page := .page }} {{ $referrerpolicy := .referrerpolicy | default "no-referrer" }} +{{ $remote := .remote }} {{ $resource := .resource }} {{ $src := .src }} {{ $style := .style }} {{ $title := .title }} {{ $width := .width }} -{{ if not $resource }} - {{ $resource = partial "paige/func-resource.html" (dict - "page" $page - "url" $src - ) }} +{{ 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 }} -{{ 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 }} - {{ . }}