mirror of
				https://github.com/Wonderfall/hugo-WonderMod.git
				synced 2025-10-30 19:35:26 +01:00 
			
		
		
		
	Add width and height attributes to cover images (#519)
- Ensures that the browser can allocate the correct amount of space in the document while the image is loading. - Reduces CLS #499
This commit is contained in:
		| @@ -98,6 +98,7 @@ | |||||||
|     border-radius: var(--radius); |     border-radius: var(--radius); | ||||||
|     pointer-events: none; |     pointer-events: none; | ||||||
|     width: 100%; |     width: 100%; | ||||||
|  |     height: auto; | ||||||
| } | } | ||||||
|  |  | ||||||
| .entry-cover a { | .entry-cover a { | ||||||
|   | |||||||
| @@ -16,7 +16,8 @@ | |||||||
|                         {{ printf "%s %s" (($cover.Resize (printf "%sx" $size)).Permalink) (printf "%sw ," $size) -}} |                         {{ printf "%s %s" (($cover.Resize (printf "%sx" $size)).Permalink) (printf "%sw ," $size) -}} | ||||||
|                         {{ end }} |                         {{ end }} | ||||||
|                     {{- end -}}{{$cover.Permalink }} {{printf "%dw" ($cover.Width)}}"  |                     {{- end -}}{{$cover.Permalink }} {{printf "%dw" ($cover.Width)}}"  | ||||||
|             sizes="(min-width: 768px) 720px, 100vw" src="{{ $cover.Permalink }}" alt="{{ $alt }}" /> |             sizes="(min-width: 768px) 720px, 100vw" src="{{ $cover.Permalink }}" alt="{{ $alt }}"  | ||||||
|  |             width="{{ $cover.Width }}" height="{{ $cover.Height }}"> | ||||||
|         {{- else }}{{/* Unprocessable image or responsive images disabled */}} |         {{- else }}{{/* Unprocessable image or responsive images disabled */}} | ||||||
|         <img loading="lazy" src="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" alt="{{ $alt }}"> |         <img loading="lazy" src="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" alt="{{ $alt }}"> | ||||||
|         {{- end }} |         {{- end }} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Ian Grünig
					Ian Grünig