27 lines
		
	
	
		
			No EOL
		
	
	
		
			830 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			No EOL
		
	
	
		
			830 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <p>
 | |
|   {{- $img := or (.Get "src") (.Get "img") -}}
 | |
|   {{- $ref := .Get "ref" -}}
 | |
|   {{- $scale := .Get "scale" -}}
 | |
|   {{- $alt := or (.Get "alt") (.Get "title") -}}
 | |
|   {{- $refImg := "" -}}
 | |
|   {{- $refPage := "" -}}
 | |
|   {{- if $ref -}}
 | |
|     {{- range where .Site.RegularPages "Params.pageid" "eq" $ref -}}
 | |
|       {{- $refImg = .Params.img -}}
 | |
|       {{- $refPage = . -}}
 | |
|     {{- end -}}
 | |
|   {{- end -}}
 | |
|   {{- if not $img -}}
 | |
|     {{- $img = $refImg -}}
 | |
|   {{- end -}}
 | |
|   {{- $image := (resources.Get (printf "img/%s" $img)) -}}
 | |
|   {{- if $scale -}}
 | |
|     {{- $image = $image.Resize $scale -}}
 | |
|   {{- end -}}  
 | |
|   {{- if $refPage -}}
 | |
|     <a href="{{ $refPage.Permalink }}"><img 
 | |
|         src="{{ $image.RelPermalink }}" alt="{{ or $alt $refPage.Title }}"></a>
 | |
|   {{- else -}}
 | |
|     <img src="{{ $image.RelPermalink }}" alt="{{ $alt }}">
 | |
|   {{- end -}}
 | |
| </p> |