File tree 1 file changed +22
-1
lines changed
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 1
- < img loading ="lazy " src ="{{ .Destination | safeURL }} " alt ="{{ .Text }} " {{ with .Title}} title ="{{ . }} " {{ end }} />
1
+ {{- $u := urls.Parse .Destination -}}
2
+ {{- $src := $u.String -}}
3
+ {{- if not $u.IsAbs -}}
4
+ {{- $path := strings.TrimPrefix "./" $u.Path }}
5
+ {{- with or (.PageInner.Resources.Get $path) (resources.Get $path) -}}
6
+ {{- $src = .RelPermalink -}}
7
+ {{- with $u.RawQuery -}}
8
+ {{- $src = printf "%s?%s" $src . -}}
9
+ {{- end -}}
10
+ {{- with $u.Fragment -}}
11
+ {{- $src = printf "%s#%s" $src . -}}
12
+ {{- end -}}
13
+ {{- end -}}
14
+ {{- end -}}
15
+ {{- $attributes := merge .Attributes (dict "alt" .Text "src" $src "title" (.Title | transform.HTMLEscape) "loading" "lazy") -}}
16
+ < img
17
+ {{- range $k, $v : = $attributes -}}
18
+ {{- if $v -}}
19
+ {{- printf " %s=%q " $k $v | safeHTMLAttr -}}
20
+ {{- end -}}
21
+ {{- end -}}>
22
+ {{- /**/ -}}
You can’t perform that action at this time.
0 commit comments