mirror of
				https://github.com/Wonderfall/hugo-WonderMod.git
				synced 2025-10-30 19:35:26 +01:00 
			
		
		
		
	Add webp to processable formats (#540)
* Add webp format only if using Hugo extended This keeps PaperMod from having a hard dependency on Hugo extended.
This commit is contained in:
		 Daniel F. Dickinson
					Daniel F. Dickinson
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							38891b9062
						
					
				
				
					commit
					10141e278e
				
			| @@ -9,7 +9,10 @@ | |||||||
|         {{- if $addLink }}<a href="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" target="_blank" |         {{- if $addLink }}<a href="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" target="_blank" | ||||||
|             rel="noopener noreferrer">{{ end -}} |             rel="noopener noreferrer">{{ end -}} | ||||||
|         {{- $sizes := (slice "360" "480" "720" "1080" "1500") }} |         {{- $sizes := (slice "360" "480" "720" "1080" "1500") }} | ||||||
|         {{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") }} |         {{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") -}} | ||||||
|  |         {{- if hugo.IsExtended -}} | ||||||
|  |             {{- $processableFormats = $processableFormats | append "webp" -}} | ||||||
|  |         {{- end -}} | ||||||
|         {{- $prod := (hugo.IsProduction | or (eq .Site.Params.env "production")) }} |         {{- $prod := (hugo.IsProduction | or (eq .Site.Params.env "production")) }} | ||||||
|         {{- if (and (in $processableFormats $cover.MediaType.SubType) ($responsiveImages) (eq $prod true)) }} |         {{- if (and (in $processableFormats $cover.MediaType.SubType) ($responsiveImages) (eq $prod true)) }} | ||||||
|         <img loading="lazy" srcset="{{- range $size := $sizes -}} |         <img loading="lazy" srcset="{{- range $size := $sizes -}} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user