Improve rendered image output for RSS
This commit is contained in:
parent
8c3116c255
commit
1e0d560ee6
1 changed files with 23 additions and 0 deletions
23
themes/red/layouts/_default/_markup/render-image.rss.xml
Normal file
23
themes/red/layouts/_default/_markup/render-image.rss.xml
Normal file
|
@ -0,0 +1,23 @@
|
|||
{{- $url := .Destination | safeURL -}}
|
||||
{{- $img := .Page.Resources.GetMatch .Destination -}}
|
||||
|
||||
{{- if and (not $img) .Page.File -}}
|
||||
{{ with .Page.File }}
|
||||
{{ $path := path.Join .Dir $url }}
|
||||
{{- $img = resources.Get $path -}}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and (not $img) .Page.File -}}
|
||||
{{- $img = resources.Get .Destination -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with $img -}}
|
||||
{{ if eq .MediaType.SubType "svg" }}
|
||||
<img class="actual-article-img" src="{{ $img.RelPermalink }}" alt="{{ $.Text }}">
|
||||
{{ else }}
|
||||
<img class="actual-article-img" width="{{ $img.Width }}" height="{{ $img.Height }}" src="{{ $img.RelPermalink }}" alt="{{ $.Text }}">
|
||||
{{ end }}
|
||||
{{- else -}}
|
||||
<em>Unable to find image {{ $url }}!</em>
|
||||
{{- end -}}
|
Loading…
Add table
Reference in a new issue