Add alt text support to figures/image shortcode
This commit is contained in:
		
							parent
							
								
									5deda1c5ee
								
							
						
					
					
						commit
						6affc7b454
					
				
					 1 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -1,8 +1,9 @@
 | 
			
		|||
{{ $img := (.Page.Resources.GetMatch (.Get "name")) }}
 | 
			
		||||
{{ $resized_img := $img.Fit "1280x1280" }}
 | 
			
		||||
{{- $img := (.Page.Resources.GetMatch (.Get "name")) -}}
 | 
			
		||||
{{- $resized_img := $img.Fit "1280x1280" -}}
 | 
			
		||||
{{- $altText := $img.Params.alt | default $img.Title -}}
 | 
			
		||||
<figure>
 | 
			
		||||
  <a href="{{ $img.RelPermalink }}">
 | 
			
		||||
    <img src="{{ $resized_img.RelPermalink }}">
 | 
			
		||||
      <img src="{{ $resized_img.RelPermalink }}"{{ with $altText}} alt="{{ . }}"{{ end }}>
 | 
			
		||||
  </a>
 | 
			
		||||
  {{ if $img.Title }}
 | 
			
		||||
  <figcaption>{{ $img.Title }}</figcaption>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue