2023-09-23 23:54:17 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{{- $alt := .PlainText | safeHTML -}}
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-16 20:49:18 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{{- $lazyLoading := .Page.Site.Params.enableImageLazyLoading | default true -}}
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-23 23:54:17 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{{- $dest := .Destination -}}
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-04 07:14:05 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{{- $url := urls.Parse $dest -}}
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-23 23:54:17 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-04 07:14:05 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{{- $isLocal := not $url.Scheme -}}
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-23 23:54:17 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{{- $isPage := and (eq .Page.Kind "page") (not .Page.BundleType) -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{{- $startsWithSlash := hasPrefix $dest "/" -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{{- $startsWithRelative := hasPrefix $dest "../" -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-16 20:49:18 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{{- if and $dest $isLocal -}}
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-23 23:54:17 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  {{- if $startsWithSlash -}}
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-04 07:14:05 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    {{- with or (.PageInner.Resources.Get $url.Path) (resources.Get $url.Path) -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      {{/* Images under assets directory */}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      {{- $query := cond $url.RawQuery (printf "?%s" $url.RawQuery) "" -}}
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-10 05:47:02 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      {{- $fragment := cond $url.Fragment (printf "#%s" $url.Fragment) "" -}}
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-04 07:14:05 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      {{- $dest = printf "%s%s%s" .RelPermalink $query $fragment -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {{- else -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      {{/* Images under static directory */}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      {{- $dest = (relURL (strings.TrimPrefix "/" $dest)) -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {{- end -}}
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-23 23:54:17 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  {{- else if and $isPage (not $startsWithRelative) -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {{/* Images that are sibling to the individual page file */}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {{ $dest = (printf "../%s" $dest) }}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  {{- end -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{{- end -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-04 07:14:05 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{{- $attributes := "" -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{{- range $key, $value := .Attributes -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  {{- if $value -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {{- $pair := printf "%s=%q" $key ($value | transform.HTMLEscape) -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    {{- $attributes = printf "%s %s" $attributes $pair -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  {{- end -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{{- end -}}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-23 23:54:17 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{{- with .Title -}}
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-19 13:42:59 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  <figure>
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-04 07:14:05 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <img src="{{ $dest | safeURL }}" title="{{ . }}" alt="{{ $alt }}" {{ $attributes | safeHTMLAttr }} {{ if $lazyLoading }}loading="lazy"{{ end }} />
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-23 23:54:17 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    <figcaption>{{ . }}</figcaption>
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-19 13:42:59 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  </figure>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{{- else -}}
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-04 07:14:05 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  <img src="{{ $dest | safeURL }}" alt="{{ $alt }}" {{ $attributes | safeHTMLAttr }} {{ if $lazyLoading }}loading="lazy"{{ end }} />
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-19 13:42:59 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{{- end -}}
							 |