redstrate.com/themes/red/layouts/_default/_markup/render-image.html

30 lines
1 KiB
HTML
Raw Normal View History

{{- $url := .Destination | safeURL -}}
{{- $img := .Page.Resources.GetMatch .Destination -}}
{{- if and (not $img) .Page.File -}}
2022-12-20 14:16:26 -05:00
{{ with .Page.File }}
{{ $path := path.Join .Dir $url }}
2022-12-20 14:16:26 -05:00
{{- $img = resources.Get $path -}}
{{ end }}
{{- end -}}
2022-12-04 07:33:52 -05:00
{{- if and (not $img) .Page.File -}}
{{- $img = resources.Get .Destination -}}
{{- end -}}
{{- with $img -}}
2022-12-27 22:34:31 -05:00
<figure>
<a href="{{ $img.RelPermalink }}" data-download="true">
{{ if eq .MediaType.SubType "svg" }}
<img class="article-img" src="{{ $img.RelPermalink }}" alt="{{ $.Text }}" />
{{ else }}
<img class="article-img" width="{{ $img.Width }}" height="{{ $img.Height }}" src="{{ $img.RelPermalink }}" alt="{{ $.Text }}" />
{{ end }}
</a>
<figcaption><i>{{ $.Text | safeHTML }}</i></figcaption>
2022-12-27 22:34:31 -05:00
</figure>
2022-10-27 09:55:48 -04:00
{{- else -}}
2022-12-27 22:34:31 -05:00
<em>Unable to find image {{ $url }}!</em>
{{- end -}}