Skip to content

Commit

Permalink
Add Cover Image to RSS feed
Browse files Browse the repository at this point in the history
  • Loading branch information
theJoshMuller committed Oct 26, 2022
1 parent 3a0a481 commit b7ae289
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion layouts/_default/rss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@
{{- if and (ne .Layout `search`) (ne .Layout `archives`) }}
<item>
<title>{{ .Title }}</title>
{{ $img := .Params.cover.image | absURL }}
{{ if isset .Params.cover "image" }}
<enclosure url="{{ printf "%s" $img }}" type="image/jpeg"></enclosure>
{{ end }}
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with site.Author.email }}<author>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
<description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description>
{{- if site.Params.ShowFullTextinRSS }}
<content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded>
{{ if isset .Params.cover "image" }}
<content:encoded>{{ (printf "<![CDATA[<img src=\"%s\" /> %s]]>" $img .Content ) | safeHTML }}</content:encoded>
{{ else }}
<content:encoded>{{ (printf "<![CDATA[%s]]>" .Content ) | safeHTML }}</content:encoded>
{{ end }}
{{- end }}
</item>
{{- end }}
Expand Down

0 comments on commit b7ae289

Please sign in to comment.