add browser-level lazy loading
ref: https://web.dev/browser-level-image-lazy-loading/
This commit is contained in:
		
							parent
							
								
									a982a29e24
								
							
						
					
					
						commit
						c353447d8e
					
				|  | @ -1,3 +1,3 @@ | ||||||
| <p> | <p> | ||||||
|     <img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}" {{ end }} /> |     <img loading="lazy" src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}" {{ end }} /> | ||||||
| </p> | </p> | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ | ||||||
|     {{- if .Get "link" -}} |     {{- if .Get "link" -}} | ||||||
|         <a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}> |         <a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}> | ||||||
|     {{- end }} |     {{- end }} | ||||||
|     <img src="{{ .Get "src" }}{{- if eq (.Get "align") "center" }}#center{{- end }}" |     <img loading="lazy" src="{{ .Get "src" }}{{- if eq (.Get "align") "center" }}#center{{- end }}" | ||||||
|          {{- if or (.Get "alt") (.Get "caption") }} |          {{- if or (.Get "alt") (.Get "caption") }} | ||||||
|          alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}" |          alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}" | ||||||
|          {{- end -}} |          {{- end -}} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Aditya Telange
						Aditya Telange