Make sure to not allocate the space if the featured image is the same as
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
		
	
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			the site-wide image
This commit is contained in:
		
					parent
					
						
							
								4d2641266b
							
						
					
				
			
			
				commit
				
					
						3f43e17029
					
				
			
		
					 1 changed files with 8 additions and 4 deletions
				
			
		|  | @ -1,4 +1,10 @@ | |||
| {{ $featured_image := partial "func/GetFeaturedImage.html" . }} | ||||
| {{ if $featured_image }} | ||||
| {{ $default_image := (trim .Site.Params.featured_image "/") | relURL }} | ||||
| {{ $current_image := (trim $featured_image "/") | relURL }} | ||||
| {{/* Trick to avoid setting the featured image if it corresponds to the main site */}} | ||||
| {{ .Scratch.Set "same_image" (eq $default_image $current_image) }} | ||||
| {{ end }} | ||||
| <article class="bb b--black-10"> | ||||
|   <div class="db pv4 ph3 ph0-l no-underline dark-gray"> | ||||
|     <div class="flex flex-column flex-row-ns"> | ||||
|  | @ -6,9 +12,7 @@ | |||
|           {{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}} | ||||
|         {{ $featured_image := (trim $featured_image "/") | absURL }} | ||||
|         {{/* Don't put the featured image in the summary if it's the default one */}} | ||||
|         {{ $default_image := (trim .Site.Params.featured_image "/") | relURL }} | ||||
|         {{ $current_image :=  $featured_image | relURL }} | ||||
|         {{ if not (eq $default_image $current_image) }} | ||||
|         {{ if not (.Scratch.Get "same_image") }} | ||||
|         <div class="pr3-ns mb4 mb0-ns w-100 w-40-ns"> | ||||
|           <a href="{{.Permalink}}" class="db grow"> | ||||
|             <img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}"> | ||||
|  | @ -16,7 +20,7 @@ | |||
|         </div> | ||||
|         {{ end }} | ||||
|       {{ end }} | ||||
|       <div class="blah w-100{{ if $featured_image }} w-60-ns pl3-ns{{ end }}"> | ||||
|       <div class="blah w-100{{ if and ($featured_image) (not (.Scratch.Get "same_image")) }} w-60-ns pl3-ns{{ end }}"> | ||||
|         <h1 class="f3 fw1 athelas mt0 lh-title"> | ||||
|           <a href="{{.Permalink}}" class="color-inherit dim link"> | ||||
|             {{ .Title }} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue